Bitswap Sniffer

A CID sniffer for content in IPFS over Bitswap and DHT requests

Bitswap Sniffer is a tool designed to monitor and record Content Identifiers (CIDs) within the IPFS network passively. It captures all the CIDs being requested across the network from the interactions it receives at the Bitswap and the DHT protocols.

Methodology

  • Passive Participation: Unlike a crawler that actively queries the network (like Nebula), the Bitswap Sniffer connects to a wide range of peers and listens for incoming WANT request lists.
  • Active Peer Discovery: Besides the sniffer benefits of stable connections to track all circulating WANT wishes, it also tries to open as many Bitswap sessions as possible proactively.
  • CID Tracking: The tool logs every shared or requested CID over Bitswap and the DHT, capturing the frequency and timing of the requests.

Impact

The data gathered by the Bitswap Sniffer is critical for understanding the demand side of the IPFS network:

  • Content Popularity and Demand: Identify which datasets or files are most frequently requested in real-time, and metrics around how many CIDs are requested by each participant.
  • Traffic Patterns: Detect surges in network activity or potential "spam" attacks involving high volumes of fake CIDs.

Usage & Integration

The Bitswap Sniffer is built in Go and integrates seamlessly with the standard go-libp2p and boxo stacks. It can be configured to:

  • Export sniffed data to ClickHouse.
  • Run as a standalone binary or as a library component within a larger measurement node.

Detailed setup instructions, configuration flags, and data schema definitions can be found in the GitHub repository.