Bitswap

Calculation

Debt ratio r.

Probability of sending to a debtor.

  • Function drops off quickly as the nodes’ debt ratio surpasses twice the established credit.

BitSwap nodes keep ledgers accounting for the transfers with other nodes.

  • When activating a connection, BitSwap nodes exchange their ledger information. If it does not match exactly, the ledger is reinitialized from scratch, losing the accrued credit or debt.

Sketch of the lifetime of a peer connection:

  1. Open: peers send ledgers until they agree.

  2. Sending: peers exchange want_lists and blocks.

  3. Close: peers deactivate a connection.

  4. Ignored: (special) a peer is ignored (for the duration of a timeout) if a node’s strategy avoids sending.

Content ID

In IFPS, every file or directory has a CID.

  • A unique SHA256 hash is used to identify the file.

Whenever the content changes, the CID also changes.

To keep track of files after being altered, IPFS uses the InterPlanetary Name System (IPNS) where the name is the hash of a public key, stored in the DHT, pointing to the CID of the latest version.

Examples

When a peer wants a block, it broadcasts a Want to all connected peers.

If there is no response, it asks the DHT who has the root CID. Peers who respond are added to the session and subsequent requests are sent only to peers in the session.

Last updated