ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

Peer gets multiple copies of a file, increasing bandwidth #4075

Closed dendmi closed 1 year ago

dendmi commented 2 years ago

Severity:

Medium-High

Description:

I thought about using js-ipfs directly in the browser to share bandwidth between users, but the opposite is the case. The more peers participate, the more copies of a file a peer gets.

I created this simple example to demonstrate this issue: Example

Node0 adds the selected file. Node1 then tries to get the file. After that Node2 tries to get the file... When everything is successful, the bitswap stat "dataReceived" of each node is shown. This are the numbers for a 10.5MB file:

As you can see, Node4 receives the file 4 times.

I also did more complex tests with puppeteer, so each peer can have its own browser instance, but the results are the same.

Is there an option I'm missing or is js-ipfs just not working correctly in the browser?

welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

whizzzkid commented 1 year ago

js-ipfs is being deprecated in favor of Helia. You can follow the migration plan here https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

Please feel to reopen with any comments before 2023-06-05. We will do a final pass on reopened issues afterward (see https://github.com/ipfs/js-ipfs/issues/4336).

This issue might be resolved in Helia, if not, please let us know!