-
Notifications
You must be signed in to change notification settings - Fork 1.2k
IPNS resolution in the browser #2921
Comments
Your js-ipfs node running in browser is unable to resolve I believe the key problem is that experimental DHT in JS is not ready for production use yet (iirc js-ipfs postponed DHT work until DHT changes land around go-ipfs 0.6) For now, use delegated routing modules which enable js-ipfs nodes to query DHT using remote go-ipfs node. Try setting it up as noted in https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs#configuring-delegate-routers. It should solve the peer routing problem, just make sure you also have preload nodes set up as well, because your browser node won't be able to dial TCP multiaddrs to fetch the content. (cc #2093) |
Hm.. I take that back, seems that right now IPNS resolution is somehow hardcoded to use DHT directly:
We probably could fix this up so delegated routing is used instead, enabling use in the browser. cc @vasco-santos to think about this in Q2 |
@lidel one issue here is that the having some typedoc validation would be good to catch these sort of things |
Bear in mind that the goal for |
@vasco-santos makes sense |
@vasco-santos seems like the current state of content-routing is |
@vasco-santos I guess I'm confused because the content-routing interface spec seems to imply that it only provides providers. But also confused because ipfs doesn't seem to use contentRouting at all |
You make a valid point here, which I also hit sometime ago when refactoring the DHT. With that in mind, we cannot use delegated routing for the time being in the browsers, since they do not implement {put, get}, until you figure out what you are pointing here. Ideally, I think that {put, get} should be part of the |
the name a question: starting with yes, but no yesish because of desired side effects now for yes, as an optimization you could seemingly use the generic pipeline just fine but would result in either
ok I answered my own question thank you 😁 sorry for the thread spam |
@kumavis thanks for exposing your thoughts here, this is valuable! I would like to see us decoupling the dht in the future into the But we get to the same issue, since we intended to unblock IPNS resolution in the browser, which is not possible now with the cc @jacobheun since we will probably spend some time on the content routing side of things next quarter, this is something that I feel that we need to solve. |
@vasco-santos Is this picture different now that we've shipped new content routing to the world and also shipped delegate nodes in js? |
Delegate nodes don't do this. They allow The conversation here was going on a way to create the same concept for So, in theory this should work now if a browser node enables DHT client mode as explained in https://github.com/ipfs/blog/blob/master/content/post/104-js-ipfs-0.48.md#-dht-configuration However, this still uses the incomplete and not stable DHT implementation for the time being. I would say that it is ready for experimenting with. |
I am trying to get inbrowser IPNS to work, and can't seem to. Tried with: ipfs = await self.Ipfs.create({
libp2p: {
config: {
dht: {
enabled: true,
clientMode: true
}
}
}
}); ...and... ipfs = await self.Ipfs.create({
config: {
dht: {
enabled: true,
}
}
}); ...and using both. Each time IPNS resolution (
Would love some pointers what to try. |
@rysiekpl |
Thanks for the link. Sorry, I should have been more clear: in the browser I am only trying to get the data from IPNS/IPFS, not publish it. And one crucial requirement is that it needs to work without me running a dedicated IPFS node that the browser code connects to. I am trying to build a censorship circumvention tool using ServiceWorkers and IPFS. The idea is that the ServiceWorker code fetches the content from IPFS if a regular HTTPS So, requiring that the ServiceWorker code connects to an IPFS node running on the (potentially censored) host is not really workable. Using a list of public nodes however - that could work. |
@rysiekpl have you checked out IPFS http client? You can connect to a remote ipfs node then do core API actions like |
@rysiekpl thank you for mentioning your project (https://samizdat.is / 0xacab.org/rysiek/samizdat/). It is a good example of how resolving IPNS in the browser context is much more important than publishing (cc @Gozala @autonome) ps. if you want additional, HTTP-based resolution fallback there is a list of public gateways here, most expose |
Yes, I looked at it. But in my case it does not seem to provide any benefit over just using IPFS gateways (which is now implemented as a Samizdat plugin), apart from standardizing the API between using gateways and embedded Since the embedded node does not seem to have
Eh, Yet Another Forum... There's a cost to joining any new community like that, and currently I would prefer to avoid that, since this issue seems to be related exactly to the problem I am having. Unless I am missing something?
Yeah, sounds about right.
Already using five hard-coded gateways in the Anyway, my takeaway from this is that IPNS name resolution in the browser (using the |
Just wanted to enter this conversation for testing purposes, once some solution becomes usable. For the time being I still get: |
Just checking in, any movement on this? I am going back to hacking on Samizdat and having IPNS resolution working directly and reliably in the browser would be a huge boon for the project. Thanks! |
Hi all. Some stuff landed, some got improved. My understanding of the current situation is that we should be able to close the gap and make IPNS fully functional in the browser out-of-the-box (fully functional in default configuration, no need to opt-in anything), if at least one of below lands:
I believe (B) is easier to accomplish, as it does not depend on pubsub in browser and go-ipfs, and we already have Delegates in js-ipfs/src/runtime/config-browser.js#L12-L16 and the remaining work is to wire things up and extend delegate modules if necessary. |
Hey hey, any news on this? |
2022-03-18 conversation: this just needs someone to review. Everyone has been fully booked on other things. Potential candidates are: |
Ping again? Is there anything a person not deeply involved in the project can do to help get this fixed? |
We're focusing on other work such as Helia and don't have the bandwidth to pick this up in the short term. For others to help get this fixed:
|
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 afterward (see #4336). Assigning to @achingbrain to answer whether this issue is already resolved in Helia, or if this issue needs to be migrated to that repo! |
The @libp2p/delegated-content-routing module is an implementation of this interface which should let browser nodes resolve IPNS names from Kubo nodes. I don't think there's a spec yet for delegated IPNS resolution in the same way there is for resolving content providers via IPNI or HTTP Routing V1 but when there is an implementation will unlock this functionality against more than just Kubo nodes. |
There is an active IPIP that I expect will close out in the next ~month once an implementation of it is made in Boxo: ipfs/specs#379 |
I was just about to link to the same one! |
Hello - thanks again for your work on
js-ipfs
. Excited to be using and testing it, and hopefully contribute. Currently I'm trying to use the in-browser node to resolve an IPNS address and it is failing. I've looked at the existing issues similar to this that are now closed but still unable to get it working. Details below:js-ipfs
version: 0.41.2go-ipfs
version: 0.4.23browser version: Chrome 80.0.3987.132
In-browser node setup:
The 2 nodes I connect to above are
go-ipfs
nodes on version 0.4.23 and ran with the--enable-namesys-pubsub
flag. They are able to publish and resolve IPNS addresses among themselves fine, it's just the browser node that is unable to do so.So basically when I try
I get the following error:
I will keep digging into this and post more info as I find it. For now, it's failing here and when I print
routingKey.toBuffer().toString()
I get"/ipns/� ��d��z?�ꃑ�Y��U���U��,}�87�x1��"
. It jumped out since part of it is string encoded and the rest is in binary but haven't looked elsewhere yet to see if this is expected.The text was updated successfully, but these errors were encountered: