TeachMeBitcoin

The Network Address Manager: Understanding `AddrMan`

From TeachMeBitcoin, the free encyclopedia Reading time: 3 min

The Network Address Manager: Understanding AddrMan

We have seen how nodes "Gossip" about addresses (Chapter 5). But where do those addresses live when the node is sleeping? They live in the Network Address Manager (AddrMan). This is the "Long-Term Memory" of the networking layer. It is a sophisticated database that keeps track of thousands of potential peers and "Ranks" them based on their reliability.

For the Sovereign Architect, AddrMan is the "Map of the Universe." A healthy AddrMan contains addresses from every corner of the planet, every type of network (IPv4, IPv6, Tor, I2P), and every level of "Age." This diversity is what prevents your node from being "Isolated."

Analyzing the Memory: AddrMan

In the source code (src/addrman.h), we see how the node organizes its contacts into "Buckets" to prevent a single attacker from filling the entire list.

/**
 * PEDAGOGICAL ANALYSIS: THE MAP OF THE UNIVERSE
 * This logic organizes thousands of addresses into "Buckets" to ensure diversity.
 */
class AddrMan
{
public:
 // The "New" bucket: Peers we have heard about but NEVER talked to.
 // The "Tried" bucket: Peers we have SUCCESSFULLY connected to.

 // This function adds a new address to the manager.
 void Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, ...);

 // This function selects a random address for us to call (Outbound).
 CAddress Select();

 // This function "Rewards" a peer for being alive.
 void Good(const CService& addr, ...);
};

Explaining the Memory: The Librarian’s Sorting

The Sovereignty of the Map

Your AddrMan is your "Security Perimeter." By maintaining a diverse and healthy list of peers, you are making it impossible for a central authority to "Censor" your connection to the blockchain. As a Sovereign Architect, you are the "Master of the Map," the one who ensures the "Digital Memory" of your machine is always rich, diverse, and accurate. You are the "Guardian of the Neighborhood."


☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!