BitswapDefinition of Bitswap

    Bitswap is the data exchange protocol used in IPFS to request and share blocks of content between peers.

    It works like a marketplace for blocks:

      Each peer keeps a wantlist (the blocks it needs) and a have list (the blocks it can provide).

      When two peers connect, they exchange their wantlists and transfer the requested blocks.

      Bitswap keeps a ledger to track how much data each peer has sent or received, encouraging reciprocity and preventing freeloading.

    In short, Bitswap is the core mechanism enabling block trading in IPFS’s content-addressed, peer-to-peer network.

    Access Control in Bitswap

      It doesn't have any sophisticated access control mechanisms built in. There's an option for the application to provide a callback function that would be evaluated for every block request, and the application can decide, given the requesting peer ID and the CID whether to authorize the request or not.

      We'll be using this for implementing Private Documents: Phase 1.