nftstorage / nft.storage

**Notice: Uploads Decommissioned - Existing Data is Safe!** NFT.Storage Classic (classic.nft.storage) offers free decentralized storage and bandwidth for NFTs on IPFS and Filecoin. June 2024 Update: No new uploads, but all existing data is safe. Try the new NFT.Storage, which preserves data in long term Filecoin storage. Go to app.nft.storage
https://classic.nft.storage
Other
619 stars 167 forks source link

Enable users to specify which cid version (Qm vs bafy) for uploads #387

Closed jnthnvctr closed 6 months ago

jnthnvctr commented 3 years ago

The HEN team mentioned that for minting metadata they need to use a separate IPFS node to generate Qm hashes for their metadata.json because of constraints in the number of characters on the contract side.

It'd be useful potentially to enable users to specify on upload whether they'd like to generate Qm or bafy hashes.

Gozala commented 3 years ago

I've put together this observable that attempts to clarify what is currently possible and what is not.

To execute you'd need to fork and add NFT_STORAGE_TOKEN secret to your profile or just substitute line that accesses it with your access token.

Here is the screenshot

image

Here is the summary

If 49 chars will satisfy contract character limit constraint, than solution is simply to take cid from nft.storage and encode it as base58btc string. Otherwise things are bit more complicated, if files aren't small (<1mb) CIDs can be encoded as v0 base58btc ( Qm...hash style). It is still possible to do it with storeCar API but that is going to involve a lot more code and maybe at that point it would be worth exposing an option to force dag-pb instead.

Gozala commented 3 years ago

@jnthnvctr do we have any idea on:

  1. Can we get someone from HEN team to comment here ? If 49char fits their limit we don't have an issue.
  2. If this just HEN team issue or if this is more common ? This might help us with decision if we should recommend car based upload or provide some option to allow CIDv0.

Thanks

Gozala commented 3 years ago

cc @alanshaw

Gozala commented 3 years ago

@crzypatchwork could you please provide some feedback here