Getting raw IPNS data like sequence number

Is there a way, using ipfs cli or the ipfs API, to get the raw data of an IPNS entry? Basically this ?

We want to put a caching layer in front of IPNS to ensure instant resolution and reliability in disconnected mode. We want a cache that is long duration, persistent, and prefers returning an old entry to not resolving at all. In order to implement this in the best possible way, we would like to have the sequence number to ensure that we don’t accept old values.

Would there be a chance to get something like this (persistent IPNS cache and configurable lookup policies) included in mainline ipfs? (no big deal if not, we realise that our use case with mobile devices is a bit peculiar)

2 Likes

Is there a way, using ipfs cli or the ipfs API, to get the raw data of an IPNS entry?

Sort of. You can directly query the DHT for the IPNS record ipfs dht get /ipns/QmId. However, this will only use the DHT and we’re working on adding other methods for resolving IPNS records.

Would there be a chance to get something like this (persistent IPNS cache and configurable lookup policies) included in mainline ipfs? (no big deal if not, we realise that our use case with mobile devices is a bit peculiar)

You may be interested in the discussion happening at:

(specifically, the --allow-expired flag).

2 Likes

I thought so. But it did not work for me because I tried to resolve just the IPNS name without the /ipns/ prefix. Now that I tried it with the prefix, it works.

So you get the raw protobuf encoded data and would have to decode it yourself, right?

Wow. You made my day. This is exactly what we wanted to implement as a proxy in front of IPFS. We even wanted to do the pinning part. Currently we have a brute force thing that just pins a number of names name every 60s, but that is obviously a very ugly and temporary solution.

So thank you! I will comment in the issue.

This would be extremely useful in many cases. Finally a way for somebody that runs a private IPFS node to easily contribute to the distribution of some selected content…

One question: you keep talking about using pubsub to publish IPNS entries. Currently pubsub is experimental and disabled by default. Does that mean that a better algorithm than floodsub is in the pipeline?

Yes.

We’ve been working on improving floodsub but, in terms of more efficient algorithms, we’re still exploring the design space.