IBC#030: Bitcoin Core Initialization, Step 12: Network Options

NAT-PMP port forwarding and connection options.

tuma

3. Dezember 2025December 3, 2025 · 3 Min. Lesezeit3 min read

Hello everyone and welcome to this new episode of Inside Bitcoin Code.

This is the first episode of the newsletter coming officially on Nostr!

Today we start diving into step 12 of the initialization of Bitcoin Core. [Code Link]

Let’s start!


NAT-PMP#

First, the program tries to automatically forward the node listening port through your router using NAT-PMP, so other peers on the internet can reach you without manual port forwarding.

Briefly, NAT-PMP allows a software to ask the router to open a port and forward it back to the computer automatically. In simpler terms, your node will ask the router to forward every connection coming to the external router port to the node local port.

Thus, the code retrieves the value of the -natpmp argument, which can be either 0 or 1. The GetBoolArg() function transforms the integer number into a boolean value, which is then fed to the StartMapPort(). In case the bool resolves to true, the function will launch the automatic port-forwarding process.

// Map ports with NAT-PMP
StartMapPort(args.GetBoolArg(”-natpmp”, DEFAULT_NATPMP));

Consider supporting this newsletter by using one of my affiliate links. These are not sponsorships, just products I use everyday. Thank you!


Connection Manager Options#

Then, the software initializes a CConnman::Options object. connOptions holds all the settings needed by the connection manager.

CConnman::Options connOptions;

Here is the list:


Let’s keep in touch:#

Written by

Comments

No comments yet. Start the conversation.