IPNS name resolve fails the first time - name.publish and name.resolve are called but works on next call

hi @danieln

we have created a runnable reproduction repo which can be found here: GitHub - imthe-1/keychain-ipns-sample at debug/lifetime-parameter.

It is basically a react app that does the publishing and resolution and logs it in the console tab inside browser dev tools. we have used chrome browser for running it.

Please do the following to get the code sample working as intended:

  1. Run IPFS node with namesys-pubsub and pubsub-experiment enabled:

ipfs daemon --enable-namesys-pubsub --enable-pubsub-experiment

  1. Please change line #6, 7 at “src/App.js” to match your IPFS node url and its websocket port respectively. it is hardcoded to this currently.
const IPFS_NODE = 'http://localhost:5001';
const IPFS_WS_PORT = 4001;
  1. Run: npm i
  2. Run: npm start

Note: we have tested the above code fragment using kubo v0.17.0 and v0.18.1 and in both the scenarios the 2nd/3rd/4th/… updates via IPNS publish were never resolved. The resolved value was always the first record that we published WHEN lifetime was set to a bigger value, in this case “3day”.
We have modified the standard ipfs-core, libp2p and libp2p-crypto libraries to accept an optional privateKey parameter for secp256k1 IPNS keypairs which allows us to create deterministic IPNS keypairs and names.
While using kubo v0.18.1 the code fragment might throw an error related quic-v1 protocol.

apologies for sharing this late. we ran into issues related to the quic-v1 protocol and could not share it because of this issue. If this is faced at your side, try removing addresses with quic-v1 protocol if possible or we can downgrade to v0.17.0

Please let me know if you face any issues. Thanks!

2 Likes