I’m looking to set up a full Bitcoin node and really want to contribute by sharing blocks and transactions with others. I’m not just interested in downloading data from other nodes.
The issue is I need my node to be accessible to others, but since I'm behind a NAT, I can’t do port forwarding. I could use a VPN, but it would only let me use non-standard ports. With other P2P networks, I can just tweak the port settings and still be reachable by all nodes.
If I set up my Bitcoin node to run on a non-standard port, will it still be reachable by other nodes?
I’ve seen some info here that suggests it might work, but I’d like to hear from some experts about it.
As far as I know, this should work. Bitcoin Core doesn't just scan random IP-addresses with the default port, so I assume it gets your node information from other nodes you're connected to. It wouldn't make sense to not include your port with that.
As an alternative, you can run your own VPN on a VPS. That gives you your own IP address and all the ports you want.
On Bitcoin's P2P network only when you dig the DNS seeds during the first time you connect to the network, you get IP addresses alone and connect to them using the default port, since that's the port they all use. But after the initial connection, each peer would advertise itself using the addr message which will contain both their IP address and the port they are listening to and that's what others would use to connect to them.
So if you use a different port than the default and you have an open socket listening for incoming connections, your node will advertise itself using that exact port.
For additional information, your node still share (as in upload) block and TX data even if your node unable to accept incoming connection. Although in such case, usually you'd share/upload less data.
That's unusual, people and software usually consider port 1023 and lower as standard or well-known ports.
There is nothing special about the default port except that it is the default. In order for other nodes to find your node, your node connects to other nodes and broadcasts its address and port.
I run several nodes on the same local network for development purposes, so I am forced to use non-default ports and external nodes are able to connect to them.