ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.2k stars 3.03k forks source link

Migration towards base32 CIDv1 #5358

Open kevina opened 6 years ago

kevina commented 6 years ago

This issue is to form a migration plan to base32 CIDv1 specific to go-ipfs. It is separate from #4143 which was more of a discussion or https://github.com/ipfs/ipfs/issues/337 which is more of a meta issue for all of go-ipfs, js-ipfs, and ipfs-companion.

Phase 1

Phase 2 -- full migration.

cc @whyrusleeping @Stebalien @lidel @magik6k @kyledrake.

kyledrake commented 6 years ago

This is great, thank you for setting this up. LMK if you need anything from me.

kevina commented 6 years ago

Issues that I currently need feedback on from the core developers:

hsanjuan commented 6 years ago

(subscribing)

daviddias commented 5 years ago

(subscribing)

alanshaw commented 5 years ago

Kind request 🙏 - there's a button on the right you can press to subscribe - commenting "(subscribing)" sends me and everyone else mentioned or participating a notification.

lidel commented 5 years ago

Some relevant updates from Golang Core Dev Team Weekly Sync 2019-02-11:

Base32/CIDv1

[..]

@eingenito - Need to consider next steps and who/when this can be picked up. @stebalien indicates that the next work to be done is converting the blockstore to use raw multihashes (Issue, WIP). This is a complicated task that needs some context for whoever picks it up.

Q: What's the relative priority of this task compared to others on this list?
A: Most important next milestone is storing/fetching [raw] multihashes in the DHT in libp2p.

DonaldTsang commented 5 years ago

Idea: Use https://github.com/kstenerud/safe-encoding as a better alternative for safe encoding

Stebalien commented 5 years ago

On technical merits alone, those encoding schemes look superior (and the order-preserving property looks quite nice). Unfortunately,

  1. We're far enough into this switch that changing the default will require a pretty strong motivation.
  2. The motivation for Base32 is wide (often built-in) language support.
lidel commented 5 years ago

Discussion that lead us to picking Base32 as the new default can be found in https://github.com/ipfs/go-ipfs/issues/4143#issuecomment-322630426:

[..] chose RFC because it's a standard, it's been around a while, nginx-misc-module supports it, and it probably has the widest support across all programming languages.

The only reason I would chose the RFC one is because it is a standard and more likely to have an implementation available as part of the language.

@DonaldTsang encodings you linked look really interesting. I believe picking RFC one is still a good choice when it comes to being the new default, but we surely can add order-preserving ones as alternative encodings. Thank you for opening https://github.com/multiformats/multibase/issues/51, let's discuss them there.

danimesq commented 3 years ago

Important:

what is the workaround to get the base32 hash of an file?

via: https://github.com/ipfs/go-ipfs/issues/7852

lidel commented 3 years ago

@DaniellMesquita you can convert any CID to CIDv1 in Base32 via:

ipfs cid base32 <cidv0>

You can also make a request to a subdomain gateway, eg. https://dweb.link/ipfs/<cid>, and you will be redirected to a subdomain with DNS-safe base32 or base36 CID:

https://dweb.link/ipfs/QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnRhttps://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi.ipfs.dweb.link/

danimesq commented 3 years ago

@lidel, ok, but how to get the base32/CIDv1 of an local file like in ipfs add -q --only-hash? Using pipelines with both commands?

danimesq commented 3 years ago

Ok, the pipelines command to get the CIDv1 of an file is: ipfs add -q --only-hash <file.extension> | ipfs cid base32

hsanjuan commented 3 years ago

ipfs add --cid=version=1 should default to base32 output.

danimesq commented 3 years ago

@hsanjuan, this command isn't compatible with the purpose of only getting the CID of an given file, instead of adding it to IPFS.

lidel told me before that the flag to get CIDv1/base32 is --cid-version 1 probably instead of the --cid=version=1 you're mentioning.

Then, maybe ipfs add -q --cid-version 1 --only-hash is the command to just get the CIDv1 of an file.

@lidel, So, its ipfs add -q --cid-version 1 --only-hash?

Is it bad to produce an different merkletree/DAG? Then, how to keep compatibility?

via: https://github.com/ipfs/go-ipfs/issues/7852#issuecomment-760468451