Skip to content
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

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

Closed
jnthnvctr opened this issue Sep 2, 2021 · 4 comments
Closed
Assignees
Labels
kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now

Comments

@jnthnvctr
Copy link
Collaborator

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.

@jnthnvctr jnthnvctr added kind/enhancement A net-new feature or improvement to an existing feature need/triage Needs initial labeling and prioritization labels Sep 2, 2021
@Gozala
Copy link
Collaborator

Gozala commented Sep 2, 2021

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

  • It is possible to upload metadata.json to nft.storage and encode returned CID string into more compact representation.
  • Gateways should be able to serve content regardless of CID encoding in the URL.
  • To get Qm...hash CID needs to V0
  • CID V0 implies DAG-PB encoding of content, but small files (< 1mb) will end up in Raw encoding instead.
  • CIDs of small files (<1mb) will not convert to CID v0 (ones that start with Qm...), because they aren't DAG-PB.
  • It is still possible to represent such CIDs in more compact encoding via base58btc strings that will be 49chars long.

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
Copy link
Collaborator

Gozala commented Sep 7, 2021

@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
Copy link
Collaborator

Gozala commented Sep 7, 2021

cc @alanshaw

@dchoi27 dchoi27 added P2 Medium: Good to have, but can wait until someone steps up and removed need/triage Needs initial labeling and prioritization labels Sep 9, 2021
@dchoi27 dchoi27 added P3 Low: Not priority right now and removed P2 Medium: Good to have, but can wait until someone steps up labels Sep 17, 2021
@Gozala
Copy link
Collaborator

Gozala commented Sep 23, 2021

@crzypatchwork could you please provide some feedback here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now
Projects
None yet
Development

No branches or pull requests

4 participants