-
Notifications
You must be signed in to change notification settings - Fork 1.2k
The IPNS Example Doesn't Work #3549
Comments
Ok, I fixed the hanging issue... I was actually using the I can even resolve the IPNS address to the hash locally and it works... but going through the gateway still doesn't ever resolve to anything. public async writeFile(arg: IpfsWriteFileArg): Promise<IpfsWriteFileResponse> {
console.log(IpfsInvokeKind.WriteFile, arg)
const { file, content } = arg
// const dirname = path.dirname(file)
// await this.mkdirp(dirname)
await this.ipfs!.files.write(file, content, {
create: true,
parents: true
})
const { cid } = await this.ipfs!.files.stat(file) // not the same as the content hash
return {
hash: cid.toString()
}
} |
I have a similar issue, local resolution but does not work through https://gateway.ipfs.io/.
|
I did configure NAT correctly, and I can resolve the file's CID from |
The JS DHT is not running by default and still needs to be tested and enhanced, in order to be reliable. This means that IPNS records will not be pushed into the DHT and other peers will not be able to resolved them, unless IPNS over Pubsub is used. Probably the gateway does not have IPNS over Pubsub enabled, nor the example. The IPNS example should have more information on what are the current conditions where it is expected to work. |
@vasco-santos: is there an issue about the JS DHT's status that we can link so interested parties can learn more as this evolves? |
Ok, so what you're saying is that for this to work, not only do I need to have IPNS over pubsub enabled but so do all of the nodes in the network? Or at least the one hosting the DHT and the one the request originates in? Does the pubsub message get propagated through the network and simply the gateway ignores it or does the pubsub message not even propagate at all? |
Looks like the answer here to get it functional is just to run a go-IPFS node by itself, and write a script that will pin and publish in that node if connected to by the client, outside of the current framework. |
Improving js libp2p discoverability connectivity is the meta issue including the DHT: libp2p/js-libp2p#703
For pubsub to work reliably, you will need to be connected to a subset of peers which are interested in the same topic as you. Accordingly, for you to use IPNS over Pubsub you need one of:
Another caveat is that IPNS over Pubsub is not enabled by default, so you need the IPNS Record publisher to have it enabled. As well as the node who is resolving records. DHT is not required, unless you want to resolve the past record. So, this means a flow like:
A quick win to improve the IPNS reliability in JS, would be to update the Pubsub fallback to the same as go currently does. This basically is using DHT Provider records, which means we would be able to just use the delegate nodes (now configured by default in |
Ok thanks for the details. It sounds like though maybe just holding off and waiting would be the right solution for me. Meaning, this feature is in progress and will eventually be enabled but right now its just in a funky state and if you absolutely need it right now then you have to do some complex work arounds but if you don't then just wait a bit for the proper feature. |
For now IPFS over pubsub should act as a workaround for some use cases. |
@lidel just to be clear for anyone who shows up here in search of an answer, IPNS name publishing over PubSub does not “work” in JS, there are no working solutions that allow publishing an IPNS hash and having it resolve content for everyone connected to IPFS nodes regardless of when they connected / what specific nodes they connected. Use Go-IPFS if you need a solution right now. |
would really appreciate clarification on whether or not ipns over pubsub will work in js-ipfs for resolving names. |
Version:
Platform:
Subsystem:
unknown
Severity:
High - The main functionality of the application does not work, API breakage, repo format breakage, etc.
Description:
Following the example on
ipfs.name.publish
and then visiting the gateway and using the published name does not work.I am using the
ipfs
node package and am running my ipfs in the main process of an electron app.I'm then adding a file:
I'm then implementing this example:
https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/NAME.md#example
But when I call the
name.publish
exactly as in the example it hangs forever:If I modify the call to have the optionsThe{ resolve: false }
then it immediately completes the call butname
returned from the result differs from the documentation, it lacks the prefix/ipns/
as shown in the documentation. Thevalue
does contain the prefix/ipfs/
as documented however. I'm not sure if that matters.The name does not resolve through the gateway.

Steps to reproduce the error:
I'm not sure exactly what I'm missing. beyond just calling the api with a hash.
The text was updated successfully, but these errors were encountered: