# Network Component

The network component handles all peer-to-peer communication in Reth, including peer discovery, connection management, and protocol message handling.

## Overview

The network stack implements the Ethereum Wire Protocol (ETH) and provides:
- Peer discovery via discv4 and discv5
- Connection management with configurable peer limits
- Transaction propagation
- State synchronization
- Request/response protocols (e.g. GetBlockHeaders, GetBodies)

## Architecture

```mermaid
graph TD
    NetworkManager[Network Manager] --> Discovery[Discovery]
    NetworkManager --> Sessions[Session Manager]
    NetworkManager --> Swarm[Swarm]
    
    Discovery --> discv4[discv4]
    Discovery --> discv5[discv5]
    Discovery --> DNS[DNS Discovery]
    
    Sessions --> ETH[ETH Protocol]
```

## Key Concepts

### Peer Discovery
The network uses multiple discovery mechanisms to find and connect to peers:
- **discv4**: UDP-based discovery protocol for finding peers
- **discv5**: Improved discovery protocol with better security
- **DNS Discovery**: Peer lists published via DNS for bootstrap

### Connection Management
- Maintains separate limits for inbound and outbound connections
- Implements peer scoring and reputation tracking
- Handles connection lifecycle and graceful disconnections

### Protocol Support
- **ETH Protocol**: Core Ethereum wire protocol for blocks and transactions
 
### Network Mode
- **PoS networks**: Block broadcasting is disabled and considered a protocol violation. New blocks are obtained from the consensus layer and requested over devp2p.
- **PoW networks**: Block announcements are enabled to help propagate new blocks quickly.
 
### Message Broadcasting
The network efficiently propagates new blocks and transactions to peers using:
- Transaction pooling and deduplication
- Block announcement strategies
- Bandwidth management

Note: In PoS networks, block broadcasting is disabled and considered a protocol violation. New blocks are obtained via the consensus layer (CL) and requested over devp2p. In PoW mode, block announcements are enabled.

### Transaction Gossip Control
- A `tx_gossip_disabled` flag can be used to disable transaction gossip end-to-end.
- This is useful for private nodes, bandwidth-constrained deployments, or setups that rely on out-of-band transaction ingestion.

### NAT and External IP Resolution
- Optional NAT resolver support helps determine and advertise the correct external IP and port for discovery and inbound connectivity.

## Next Steps

- Learn about the [Transaction Pool](/sdk/node-components/pool)
- Understand [Consensus](/sdk/node-components/consensus) integration
- Explore [RPC](/sdk/node-components/rpc) server setup
