-
Notifications
You must be signed in to change notification settings - Fork 1.2k
A viable alternative to go-ipfs? #1563
Comments
After giving it some additional thought, js-ipfs is missing:
|
Would a post install step to symlink ipfs -> jsipfs if ipfs isn't already taken be useful or just complicate things? |
What about a ipfsd-ctl like cli ? we would have only one jpfs bin with the option to choose from go or js, we could even have it work like nvm and provide the version to run. Makes sense ? |
I agree with @hugomrdias , CLI UX needs to be solved before we start playing with default symlink. Perhaps it could be something like this:
I've found another reason why people run
|
More reasons people pick go-ipfs:
|
In the meantime if you want your JS node to be more like a Go node: #!/bin/sh
jsipfs config 'Addresses.API' '/ip4/127.0.0.1/tcp/5001'
jsipfs config 'Addresses.Gateway' '/ip4/127.0.0.1/tcp/8080'
jsipfs config 'Addresses.Swarm[0]' '/ip4/0.0.0.0/tcp/4001 |
I believe it is time to revisit this issue, not with the goal of creating a viable alternative for the sake of doing it, but focusing on what would it mean to move out of α into
What do folks think? |
Just my two cents, but why try to mimic go-ipfs and make people want to type What really sets js-ipfs apart in my opinion is the ability to run it in the browser. It requires zero installation and config from the least tech-savvy person in the world. Go can't touch that, and thus go-ipfs doesn't have a chance of running on every computer in the world until it's bundled with OSes/browsers---which won't happen until browsers are running it anyways in their webpages/service workers as js-ipfs. I think js-ipfs should double down on its strengths---getting into the hands of normal people and driving mainstream IPFS adoption via the browser---and let go-ipfs have its natural habitat on servers and desktop installs. |
I agree with @npfoss: focusing on drop-in replacement for go-ipfs makes js-ipfs play a losing catch-up game and miss the opportunities provided by the web platform. We had some informal discussions about reframing js-ipfs as web-first product (in past it has been Node-first, browser-second), and community seems to be really supportive of that direction. FYSA there is already a huge body of work related to js-ipfs in browsers:
I really think we should double down on this. |
I think our aim is to have IPFS and supporting technologies be a standard, as widely used as HTTP - to do that complete implementations in many languages need to exist. Ideally we wouldn't have to do this all ourselves (which is starting to happen, at least to the libp2p components) but there will be a certain amount of bootstrapping that needs to happen. Developer adoption will be key to this - JS devs will want a JS implementation and Go devs will want a Go implementation. They can debug "their" implementation more effectively, it fits with their existing tooling and development processes and it's more likely to respect the conventions of their platform. As long as they can discover each other & exchange data, I don't see why each can't leverage their own strengths. The 'catch-up' game is part of this, but if we can agree what 'complete' means, perhaps we can limit it's scope to make it more achievable, then get on to all the cool stuff in @lidel's list. I think a lot of this is a question of prioritisation and resourcing. |
💯 At some point, we’re going to need to tackle the bundle size issues. There’s been work to incrementally bring this down over time, but more drastic changes to how js-ipfs and its dependencies are structured would be necessary to bring it down below 1mb. At some point, this actually conflicts with the goal of “feature parity,” or at least OOTB feature parity, with go-ipfs. I’ve been exploring what IPLD looks like when paired down to run in a much more restricted bundle size. This has meant writing dependencies that don’t include Node.js polyfills like The way js-ipfs is structured is a bit of a “kitchen sink” approach. It’s a large project that comes with a very large set of functionality. That means a big bundle, and bringing that bundle down means shipping with less OOTB features and more user configuration of the exact features each user wants to include. |
I resonate with this. In fact, we've done an exercise to identify what is IPFS Core multiple times (specially for go-ipfs as the scope increased a lot there too) and the conclusion is always the same: An IPFS implementation needs to be able to provide and retrieve files from the IPFS network, and from that you unpack that you need Bitswap, Magic Connectivity and Files Data Structures (i.e. IPLD). What it does not require are things such as:
Now, there are some things that should be priority such as: Anything that helps achieve the main goal of retrieving and providing files vs. GC and other utilities. This takes us to @lidel's list #1563 (comment)
@hugomrdias can you list here the issues that track your work on reducing the bundle size? I know https://bundlephobia.com/[email protected] is linked from the README, but I recall an issue like an awesome endeavour that you were pursuing.
Thanks to @hugomrdias' work we actually can have a peek at what takes space through https://bundlephobia.com/[email protected] As you can see, the larger chunk are the Crypto things (node-forge 18.5%, tweetnacl 3.9%, libp2p-crypto 2.2%) that take 24.6% of the bundle. That is 344kB that are hard to reduce as the nodes need the crypto to communicate with the other nodes. We also have things that are in progress to disappear with #1670, namely: readable-stream Btw, I was surprised to see that multicodec and multihashes are so big, am I alone? One other note, scanning through https://github.com/ipfs/js-ipfs/issues, I can't find any user of reporting the current gzipped bundle size being a deal breaker for them. |
One more remark on the topic of making JS IPFS more Browser first. In addition to developing solutions to needs described in the issues listed by @lidel at #1563 (comment), we also need to effectively test to ensure that a JS IPFS node works fully on the browser, so that situations like #2093 stop being a surprise and rather something we now. More concretely, what I'm thinking is that tests should:
This work doesn't fall within the categories of feature parity or bundle size reduction, it is about being able to be fully confident about the claims we want to make. Historically (when we started), spawning multiple browsers and create a tiny network was painful, today we have things such as https://github.com/GoogleChrome/puppeteer which should make things much more pleasant to build :) |
Is it the case that we need crypto that isn’t part of WebCrypto to communicate with any node, or is it just that we have optionality in libp2p that needs additional crypto to communicate with some nodes and not others? I ran into this w/ multihash already. Bundling all the possible hash functions is expensive but if you pair down to just SHA hashes you can get an incredibly small multihash implementation.
I think this may be what people mean when they say there has been a “node first” approach as opposed to a “browser first” approach. There’s not that much penalty for including a lot of optional behavior people only use occasionally in Node.js. In fact, it’s a much better developer experience to have these things “just work” without having to import or configure anything. But in the browser it’s quite expensive to include transports and hash functions the user may not even use, and it may be more acceptable to expect developers to import and configure these when they need them.
It would make sense to me not to invest in more complicated browser testing infrastructure until we first get coverage reports working for our browser tests. It’s not that I don’t think these more complicated tests would be useful, it’s that I don’t see how we would be able to measure and understand how useful they are without coverage. Puppeteer has coverage support and there’s a module for getting istanbul compatible coverage reports, so we can even overlay/combine the coverage between nodejs and the browser. |
We might be able to make some of the more esoteric bits opt-in, we've talked about making IPFS modular a la libp2p before, but like David says, the issues people open aren't that the bundle is too big, it's that content/peers are hard/slow to discover and that they have problems understanding the API/functionality IPFS presents. We should obviously strive to keep the bundle size down, but from the sort of issues people open, it's not the most pressing issue people are running into. |
One additional thought. If we have a large dependency chain that we only need once we reach specific network conditions, we could break that off into something we load dynamically when we reach that state. I don’t mean webpack code splitting here, I mean just loading a module we’ve published to CDN dynamically which wouldn’t cause code splitting in anyone’s bundle. Since this only gets triggered under a particular network operation, we’re already doing something async and can async load an additional set of modules. This could bring down the bundle size and only load certain behavior when necessary. This would cause a mild performance penalty when the condition is met, but it’s probably worth it if it can dramatically increase the startup performance. |
Fair enough, but we should keep in mind that we won’t hear from users who simply can’t use the software at all because of how they need to distribute and run the software they would like to build on it. The current bundle is too big for most mobile applications, too big for cloudflare workers, and due to other constraints mostly doesn’t work in Lambda and other serverless environments. That’s a fairly large amount of distribution we’re currently left out of and won’t hear from until something changes on our end or theirs. |
Prior art #804 |
Just came here to double down on @lidel's comment #1563 (comment) ...to use js-ipfs in place of go-ipfs we'd need improvements on the observability and specifically the prometheus end point. But! It looks like this thread has unearthed an emerging consensus that we want to define a subset of the IPFS api as essential, and make it work really well in the browser & node.
Are we ready to define what features js-ipfs won't focus on? Which parts are optional, and could be extracted to seperate modules? Who's going to lead this charge? |
js-ipfs is being deprecated in favor of Helia. You can #4336 and read the migration guide. Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterwards (see #4336). This is super relevant to our current js-ipfs deprecation and something that @BigLep and @achingbrain should peek at before we close for good (i.e. i'm leaving open for now). Some things I think are important for you two to consider:
There are already decent benchmarks showing that Helia can be a replacement for Kubo (go-ipfs's new name for those not aware) in some cases, and will probably be many more shortly. For those interested, please help us make Helia even better! |
You guys would know better than me, but it seems like the networking headaches alone make a Browser vs Node focus somewhat at odds -- it's not just about ECMAScript. Plus having a more intense focus on the core value add of Helia (living in the browser, where Kubo can't reach) just helps across the board on prioritizing what matters most to bring IPFS forward. I recently came back to building on IPFS and have been disappointed that the best option is still to just use a gateway... Just my 2c though, I'll be cheering for you regardless |
@npfoss gateways will be the fastest for a while; at least until we get more webtransport (in kubo/iroh/other impls, as well as more browser support) and Helia nodes in the wild, but Helia (and latest libp2p updates) have improved the browser support of IPFS drastically. If you are using a gateway, the trustless gateway fetching and block validation (one example of doing this in a recent PR I opened, https://github.com/ipfs/ipld-explorer-components/blob/1cf10d17d091eb52054b721fa54e4f7eba0e480d/src/lib/get-raw-block.ts#L105) is a great path forward. |
glad to hear it :) sounds like things are really moving again
ooh cool, maybe I should switch over for the validation, even if it is still gateway backed |
Per #1563 (comment) and the js-ipfs deprecation, I'm going to close this issue. This issue has been marked as a notable historical issue in #4336 . Feel free to repent by 2023-06-08 if there are critical open items on this topic that anyone wants to discuss. |
I would very much like for the js-ipfs implementation to be the most widely used IPFS implementation and I'm interested to know what the main blockers are for that.
We realise you have a choice of IPFS provider and your choice in important to us.
Or in other words, why do you type
ipfs daemon
and notjsipfs daemon
?I've had some interesting insight already:
The text was updated successfully, but these errors were encountered: