Skip to content

Instantly share code, notes, and snippets.

@jbenet
Last active August 29, 2015 14:11
Show Gist options
  • Save jbenet/09618faa84388a58a588 to your computer and use it in GitHub Desktop.
Save jbenet/09618faa84388a58a588 to your computer and use it in GitHub Desktop.

BitSwap - HTTP inspired version

What if BitSwap worked like this:

% bitswap-telnet :1234
> ID <local ID> <bitswap version> <user agent>
< ID <remote ID> <bitswap version> <user agent>
> Ledger <local outgoing bw> <local incoming bw>
< Ledger <remote outgoing bw> <remote incoming bw>
> Want <hash 1>
> Want <hash 2>
< Block <data that hashes to <hash 1>>
> Unwant <hash 1>
< Block <data that hashes to <hash 2>>
> Unwant <hash 2>
> <EOF>

Example

% bitswap-telnet :1234
> ID QmeQNrPwiyWWCSBvAs7N1or6gdS6Jqf2Cx217KTToZxtWP bitswap/1.0 go-ipfs/1.2.4
< ID QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ bitswap/1.0 go-ipfs/1.2.4
> Ledger 16777216 26777216
< Ledger 26777216 16777216
> Want QmXeyo43M6AawA1ZpGDZyQKMB2D7W8oWKpXTzeo7FG9ShR
> Want QmZex8YhLeSvqmpHfNwokAZmPScESr37tMetK2eJsLyufj
< Block aaaaaaaaaaaaaaaaaaaaaaaaa
< Block bbbbbbbbbbbbbbbbbbbbbbbbb
> Unwant QmXeyo43M6AawA1ZpGDZyQKMB2D7W8oWKpXTzeo7FG9ShR
> Unwant QmZex8YhLeSvqmpHfNwokAZmPScESr37tMetK2eJsLyufj
> <EOF>

We could have both text + protobuf (multicodec) versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment