go-bitswap icon indicating copy to clipboard operation
go-bitswap copied to clipboard

Docs On Initializing And Using Bitswap In Readme

Open hannahhoward opened this issue 6 years ago • 1 comments

It would be great to demonstrate how to setup and use bitswap in the Readme.

This would include initialization:

  • creating a libp2p host (can use mocknet for example purposes)
  • setting up a bitswap network interface (from Libp2p host -- see network/ipfs_impl.go)
  • initializing a blockstore
  • creating an instance of bitswap from context, blockstore, and network interface (may want to look at GraphSync README for model for this part) (github.com/ipfs/go-graphsync)

Use Bitswap, Including:

  • Request a block with GetBlock
  • Request multiple blocks with GetBlocks
  • Indicate you have a block with HasBlock
  • Get information with WantlistForPeer / LedgerForPeer
  • Create a Session (w/ NewSession)
    • GetBlocks from a session

hannahhoward avatar Jul 04 '19 19:07 hannahhoward

This would be awesome!

Stebalien avatar Jul 04 '19 20:07 Stebalien