-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPNS is not working consistently #230
Comments
I believe the implementation js-ipfs used is the same as what helia uses: https://github.com/ipfs/js-ipns
That's good news, right?
This is most likely due to problems called out in #182. follow that issue for more.
While #182 is not resolved, I imagine this will be an issue for browser-authored records.
Another item I expect resolving #182 to help resolve
the lifetime value is set here. I get this is probably a naive question, but can you confirm you are passing the value properly? The code where you're calling the actual js-ipns implementation with lifetime (1, 2) seems to be hidden behind the private I was able to find the code for the function you're using on npm: async linkToIPNS(ipfsAddr, keyName, keyId, opts = {}) {
const namespace = '/record/';
const b58 = base58btc.decode(`z${keyId}`);
// console.log('b58', b58);
const ipnsKeys = ipns.getIdKeys(b58);
// console.log('ipnsKeys', ipnsKeys);
const topic = `${namespace}${uint8ArrayToString(
ipnsKeys.routingKey.uint8Array(),
'base64url',
)}`;
// console.log('topic', topic);
await this.coreClient.pubsub.subscribe(topic, (msg) => {
// console.log('[coreClient]', msg);
});
await this.ipfsHttpClient.pubsub.subscribe(topic, (msg) => {
// console.log('[ipfsHttpClient]', msg);
});
const httpClientSubs = await this.ipfsHttpClient.pubsub.ls();
// console.log('[httpClientSubs]', httpClientSubs);
if (
!httpClientSubs ||
!httpClientSubs.length ||
!httpClientSubs.includes(topic)
) {
console.warn('[httpClient could not subscribe]');
}
const coreClientSubs = await this.coreClient.pubsub.peers(topic);
// console.log('[coreClientSubs]', coreClientSubs);
const { id: clientPeerId } = await this.ipfsHttpClient.id();
if (
!coreClientSubs ||
!coreClientSubs.length ||
!coreClientSubs.includes(clientPeerId)
) {
console.warn('[coreClient could not find peer]');
}
const multihash = uint8ArrayFromString(keyId, 'base58btc');
const digest = Digest.decode(multihash);
const libp2pKey = CID.createV1(0x72, digest);
const ipnsName = `/ipns/${libp2pKey.toString(base36)}`;
const httpClientNamesysSubs = await this.ipfsHttpClient.name.pubsub.subs(); // API
if (!httpClientNamesysSubs.includes(ipnsName)) {
console.warn('IPNS path not found');
}
const resp = await this.coreClient.name.publish(ipfsAddr, {
key: keyName,
resolve: false,
lifetime: opts.lifetime || '3day',
});
return resp;
}
Is there a modification to tests at https://github.com/ipfs/js-ipns/tree/3d3807f9a0ed5b1d5b06990c916a426d7c9200d0/test that could reproduce your problem more specifically? |
Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days. |
This issue was closed because it is missing author input. |
hi @SgtPooki apologies for the late reply.
Yes
@SgtPooki after going through the details in #182 it feels like until this issue is addressed and the underlying 2 other issues Helia will continue to have this problem. We can also see that there is some progress on the issue(Enable WebRTC Transport to help solve #256). We do however, have the following concerns:
Meanwhile this above is worked upon can you please suggest some alternatives or guide us in a direction using which we can achieve:
|
My project, Lume, which uses helia also has some very bad hit/miss on IPNS when trying to even load things like IPFS works a lot better, though I still have failed to load JS files from |
I think ipfs/helia-ipns#55 may help out for users coming to this issue with problems resolving DNSLink records: ipfs/helia-ipns#55 That is separate from this issue, as IPNS records being discussed here involve the records stored in the Amino DHT |
@BigLep @2color @lidel @tinytb
What we need
hey IPNS, publish a record with lifetime 100years using k1 keys. Published. Oh wait! there is new data, please update with same lifetime. Reslolves from a different node. Data relects. BAMMM!
In detail, what we need is:
1. Resolution of IPNS names to the latest value when records are published/updated within short time span such as 10 seconds.
2. Achieve IPNS Permanence - persist IPNS names for a long period of time(theoretically, forever. lifetime: 10... * 365 * 24 * 60 * 60 * 1000).
Current long standing issues with js-ipfs that we have not been able to fix or find root cause to:
Link to a sample we created with js-ipfs to reproduce the issue: https://github.com/imthe-1/keychain-ipns-sample/tree/debug/lifetime-persistence-verbose
We have the same sample use-case implemented in Helia as well althoug as an inital PoC only. Helia PoC findings:
We followed a similar approach as browser-ipns-publish in Helia for proper IPNS name propagation.
Link to the sample code with Helia: https://github.com/imthe1self/helia-connectivity-demo-forked-/tree/debug/topic
PS: we used code from codesandbox.io that was probably created by @SgtPooki and added our sample use-case to it. thank you @SgtPooki!
Our use-case
Publish data to IPNS and update it over time from the client device(mobile app or browser). Update can happen as quickly as within a few seconds from the last publish in certain scenarios. For this we run an IPFS node in the browser, create an secp256k1 IPNS keypair, obtain the topic name and make this browser node and one remote kubo node subscribe to this topic. We then publish to IPNS.
We have followed this example for browser IPNS publish(link: https://github.com/ipfs-examples/js-ipfs-examples/tree/master/examples/browser-ipns-publish)
Note: we use secp256k1 IPNS keypairs and have modified "createKey" in js-ipfs to accept an optional private key "optPrivateKey" for creating the same IPNS keypair when required. There is a specific reason for this and we can't use RSA or ED25519 keypairs.
The text was updated successfully, but these errors were encountered: