Asset URL max length (how to link IPFS)

I’d like to create an assest that links to an IPFS database. However the IPFS link is longer than the URL character limit. Is there a way around this? I could use an URL shortener (like bit.ly) but that adds a point of failure, so I’d like to avoid that if possible.

Alternatively, I considered using the IPFS CID as the ASA name and link to the host, but again the CID is longer than the maximum asset name length…

The CID is 45 characters long.

2 Likes

I agree, the URL length needs significantly expanded. The metadata hash field should be expanded as well.

1 Like

Hi - there does not seem to be a perfect approach to this - at least that we’re aware of. At dahai.uk we write the IPFS uri into the note field of the asset when it is created like this: ipfs://gsdfgsdfsdfgsdfgdfgsdfwhatever/

We then take a 32 byte hash of this string and put that into the metadata hash field. Whilst it is possible to change the note field, the hash ensures that the holder knows if it has been modified.

Not a perfect approach, and would love to hear of alternatives.

Hi Meltie,

Thanks for the input. I was considering something similair (add the IPFs CID / gateway to the minting transaction note), but I was unaware this note could be changed. I will do as you suggest and add the hash as well.

It seems the best solution would be to increase the hash limit to 46 so the IPFS CID can be listed there directly (and then use the URL to reference the gateway). But I’m unsure if this is technically feasible or how we’d go about officially proposing it?

I could easily be wrong about the note being changeable… I think I made an assumption about that so its worth checking. If it is not changeable then no-need for the hash I guess.

Another way is to split the hash into two and place the first part in the URL and the second part in the metadata hash… but urgh.

As to proposing the change, maybe chatting with algorand on discord is a good place to start?

The note is not changeable. On future transactions you could put different notes in, but once a note is in the blockchain, it is forever. Also we are looking at changing the limit in the field.

2 Likes

That would be great — where is that discussion happening?

You could weigh in here: TEAL 4 Epic · Issue #1950 · algorand/go-algorand · GitHub

But honestly, there isn’t a lot of nuance to this particular conversation - I think everyone has come to realize that 32 bytes is too small. The current intention is to expand the limit to 96 bytes. That seems to allow a bit of breathing room beyond the hashes that are commonly used on ipfs.

3 Likes

Sounds like a great idea :tada: