Implement an IPFS compatible CID function in Elixir using Multihash SHA256
- Dominant language
- Elixir
- Stars
- 38
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
This issue/epic is dedicated exclusively to ***How*** i.e. _implementation_
> For the _reasoning_ behind ***Why*** we are writing this code, please see: #1
If anything is _unclear_ as to ***Why***, ***please comment*** on that issue.
(_we **all** need to be **100% clear** on **Why** we are doing this work if you aren't, **Ask Questions**!_)
# Todo
+ [ ] _Read_ the JavaScript Implementation of CID: https://github.com/multiformats/js-cid
to understand how it works. If you have questions, please ask them in: https://github.com/dwyl/learn-ipfs/issues
+ [x] **try** out any examples in the docs on **`localhost`** and try to see if _re-ordering_ elements in an Object or _nested_ Array produces a _different_ CID.
+ [x] Document the _process_ of trying out the JS cid implementation.
(_i.e. this is for **everyone** to learn, not just the **one** person!_)
+ [x] Read the "_not working_" Elixir version: https://github.com/nocursor/ex-cid
+ [x] See if it's "_salvageable_" or if we need to write our own implementation from _scratch_.
> (_obviously my preference is to use a module someone **`else`** has invested time in,
to avoid "fragmenting" the ecosystem, but if the author does not respond to issues requesting help, then I am not left with much choice ..._ 😢)
+ [ ] Implement an "offline" version of CID in Elixir that produces the _exact_ same CID as the JS version.
+ [x] `cid` of a **`String`** should always be the same for a given string.
+ [x] `cid` of a **`Map`** should work regardless of the order of content.
> The way I did this was to _order_ the keys of the `Map` but we need to check the JS implementation to _ensure_ that's how they have done it.
+ [ ] What _other_ types of content do we want/need to create CIDs for? (_can we add them later?!_)
# MVP CID v1
for our MVP we _only_ need a `sha2-256` hash in `Base58BTC` which is URL-safe.
For this we can use the code from https://github.com/multiformats/ex_multihash (_which is maintained_) and https://github.com/nocursor/b58 (_which is unresponsive_) respectively.
+ [x] Write _comprehensive_ **`doctests`** that demonstrate that the code works as expected.
+ [ ] Create _beginner-friendly_ examples. (_we can split this out into separate repos later!_)
+ [x] Re-org the Readme of _this_ repo so the "theory" & reasoning is lower down
+ [x] and the "get started in 1 minute" is at the top.
+ [x] Publish to Hex.pm :shipit:
+ [ ] PR to https://github.com/multiformats/multibase
> @RobStallion I apologise for using the expression ["deep dive"](https://github.com/dwyl/cid/issues/8#issuecomment-447015490) to describe this quest.
I sometimes _forget_ that certain expressions aren't widely used outside of the tech community. 😕
(_and sadly, we don't **yet** have a comprehensive **glossary** of common tech expressions/terms ..._)
https://en.wikipedia.org/wiki/Deep_diving just means "_diving to a depth beyond the norm_".
i.e. diving into the code/examples/docs _beyond_ the superficial.
We need to **_deeply_ understand _everything_** about IPFS CIDs so that we can create compatible Elixir-lang implementation that we can use to create cids for all our content.
_Deeply_ understanding the JS/Go-lang CID code requires "Deep Work" [youtu.be/ZD7dXfdDPfg](https://youtu.be/ZD7dXfdDPfg)
This is a prereq to writing a CMS, a Learning Platform and a Time/Task Management app!
i.e. this is a "foundational piece" for the entire future of @dwyl (`#NoPressure`...)
# Relevant Reading
+ [x] general background https://github.com/nelsonic/learn-ipfs/issues/6
+ [x] docs: https://docs.ipfs.io/guides/concepts/cid/
+ [x] post: https://pascalprecht.github.io/posts/content-identifiers-in-ipfs
# `Help Wanted`
We _really_ need help on getting this package built, documented and shipped so we can move forward with our "stack" https://github.com/dwyl/technology-stack/issues/67 and "roadmap" https://github.com/dwyl/product-roadmap
If you have the curiosity, energy and time to help, please _comment_ below! (_Thanks!_)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.