contentHash resolution to IPNS

With EIP1577 becoming widely supported since metamask 6.6.0, I decided to update my personal domain to use the new resolver.

I already knew that the multiaddress format used to encode the contentHash can hypothetically point to any ressource on any protocole, but I have so far only experimented with ipfs and swarm.

In order to avoid having to update this field everytime my website gets updates, I set up an IPNS pointer to it. However, manager.ens.domains does not accept ipns:// addresses.

Is that a limitation of the manager ? If so which too do you recommand to translate ipns hashes to bytes ? Otherwise, what is missing ? ipns definition in the multiaddr format ? support by metamask ? something else ?

There is no IPNS multiaddr type listed in https://github.com/multiformats/multicodec/blob/master/table.csv so the first step would be to add something here. After that it would need to be added to the relevant libraries that implement multicodec. At that point it could be added to user interfaces.

Edit

After thinking about it, it might be that IPNS should be its own namespace. So you would want to add an ipns-ns namespace entry.

The end result of binary encoding (for example) /ipns/QmQ4QZh8nrsczdUEwTyfBope4THUhqxqc1fx6qYhhzZQei would then be:

<ipns-ns><0x01><0x30><multihash>

where <ipns-ns> is whatever value is assigned to it in the multicodec table, 0x01 is the CID, 0x30 is the multicodec ID for multihash and <multihash> is the encoding of whatever hash you have (I’d imagine that you would need to handle identity and keccak-256 at a minimum).

That said, I’m not an expert in this area in any way so it would be good to run it past others to confirm if this is the appropriate encoding before it is added to client libraries.

I’ve kicked off the process to add the IPNS namespace: