Now that base36 support is landing into go-ipfs for unrelated reasons I would like to resurrect my pitch from 3 years ago to default to base36 rendering as opposed to base32. The internals of go-ipfs operate over binary CIDs so the proposed change is strictly concerned with "UX".
Let me know your thoughts!
✅ Pros
- Consistency across the board: libp2p-key and unixfs-entry pointers all look like what the wider public knows as "a CID"
- Brings "semi-avalanche effect" to identity CIDs. E.g.
|
|
|
| Data: |
sufficiently long payload |
sufficient1y long payload |
| B32Cid: |
bafkqagttovtgm2ldnfsw45dmpeqgy33om4qhaylznrxwczak |
bafkqagttovtgm2ldnfsw45brpeqgy33om4qhaylznrxwczak |
| B36Cid: |
kumq0v1xsl33xy9ospzfmf6uuibi0jxtdsrmhovipx6o0a |
kumq0v1xsl33xy9ospzfmbp3zrpszmf3tbmvd50ou83pje |
- Increases the usable size of an identity-cid from 34 to 36 bytes of "blocksize" while still usable in subdomains (max 63 characters):
1 + ceil( (4+blocksize) * log(256) / log(base32-or-36) )
❌ Cons
- Early adopters are already familiar with
bafy..., another switch would create further confusion
- Somewhat slower ( on my macbook I can encode and decode
( 1 * 1000 * 1000 * 1000 ) / 2672 = 374251 b36 CIDs in 1 second ):
go-multibase$ go test -count=1 ./... -cpu=1 -bench . -benchmem
goos: darwin
goarch: amd64
pkg: github.com/multiformats/go-multibase
BenchmarkRoundTrip/base32 2190152 541 ns/op 256 B/op 4 allocs/op
BenchmarkRoundTrip/base36 464097 2672 ns/op 336 B/op 5 allocs/op
BenchmarkRoundTrip/base58btc 564238 2220 ns/op 336 B/op 5 allocs/op
BenchmarkEncode/base32 5402474 234 ns/op 192 B/op 3 allocs/op
BenchmarkEncode/base36 608466 1966 ns/op 192 B/op 3 allocs/op
BenchmarkEncode/base58btc 739843 1585 ns/op 192 B/op 3 allocs/op
BenchmarkDecode/base32 4150816 278 ns/op 64 B/op 1 allocs/op
BenchmarkDecode/base36 1604271 742 ns/op 144 B/op 2 allocs/op
BenchmarkDecode/base58btc 1804045 643 ns/op 144 B/op 2 allocs/op
Now that base36 support is landing into go-ipfs for unrelated reasons I would like to resurrect my pitch from 3 years ago to default to
base36rendering as opposed tobase32. The internals of go-ipfs operate over binary CIDs so the proposed change is strictly concerned with "UX".Let me know your thoughts!
✅ Pros
sufficiently long payloadsufficient1y long payloadbafkqagttovtgm2ldnfsw45dmpeqgy33om4qhaylznrxwczakbafkqagttovtgm2ldnfsw45brpeqgy33om4qhaylznrxwczakkumq0v1xsl33xy9ospzfmf6uuibi0jxtdsrmhovipx6o0akumq0v1xsl33xy9ospzfmbp3zrpszmf3tbmvd50ou83pje1 + ceil( (4+blocksize) * log(256) / log(base32-or-36) )❌ Cons
bafy..., another switch would create further confusion( 1 * 1000 * 1000 * 1000 ) / 2672 = 374251b36 CIDs in 1 second ):