Feat: create `dart` version of `cid` package
nelsonic opened this issue · 13 comments
At present there is no package on pub.dev
matching the keyword "cid": https://pub.dev/packages?q=cid
Todo
- Port the
Elixir
code from https://github.com/dwyl/cid to this repo indart-lang
♻️ - Create a Pull Request to get early feedback on code. 🆕
- Publish the package to
pub.dev
this will be our firstdart
package! 📦- Document the process for publishing a package: dwyl/learn-dart#22
Note: for biz continuity purposes, the package will be published under the
dwyl
namespace/ownership.
There appear to be a few options available for Base 58
in dart
: https://pub.dev/packages?q=base58
So at least we don't need to implement that part before being able to build cid
in dart
. 👌
@LuchoTurtle as discussed on Standup this morning,
If you want to fork the https://github.com/C0MM4ND/dart_fast_base58 for security reasons
and include it as a git
dependency in our cid
implementation, go for it:
dependencies:
flutter:
sdk: flutter
dart_fast_base58:
git:
url: https://github.com/dwyl/dart_fast_base58.git
ref: main # branch name
Having read:
https://sovereign-individual.xyz/posts/future-proof-crypto-hashes/
https://sovereign-individual.xyz/posts/ipfs-content-identifiers/
https://docs.ipfs.tech/concepts/content-addressing/#cid-conversion
https://multiformats.io/multihash/
and perusing dwyl's CID implementation at https://github.com/dwyl/cid/blob/master/lib/cid.ex,
I tried to search for implementations of Multihash
I could use in Dart and found there to be none. The closest I found was multibase, which really isn't the same thing and it's not how IPFS does things.
So should I try to implement my own version of Multihash in Dart? Never done this nor done anything crypto-related 😅 .
What do you think?
@LuchoTurtle Good research and follow-up question. 👍
We can do the Multihash
later. It's not a prerequisite for cid
. 💭
Once we have a basic cid
implementation in Dart
,
enough to do what we need in our Flutter
App, 📱
very happy to do any deep-dives into more advanced features. ⏳
Please create an issue in the backlog for Multihash
now 🆕
so we know what is next and can link to it from the README.md -> Roadmap
Section. 🔗
Stoked you're getting a chance to dive into Crypto. 🔐
It's a real differentiator on your CV to have a deep technical understanding of the topic. 🤓 👌
If along your journey to understanding all this you learn new things, 🔍
please add a section to: https://github.com/dwyl/learn-cryptography 📝 🙏
We can do the Multihash later. It's not a prerequisite for cid. 💭
You are right it is not a prerequisite for CID. For CID v0 it is not used but I feel like going for v1 would be better not only for us but for anyone who wants a cid
in Dart.
After doing research, I noticed that there wasn't a Dart implementation of Multihash so I went along and have an mvp working (encoding and decoding) -> #2.
I still want to iron out a few features and then get it featured on the canonical repo of multiformats
https://github.com/multiformats/multihash#implementations. There's more info on the PR #2.
This will change the scope of the repo to Multihash. I will use this one and work on the CID making use of Multihash on a different one. Is that reasonable? 😄
@LuchoTurtle great that you proactively implemented something.
Figuring out how all of this works under the hood is a non-trivial task.
And you are growing leaps and bounds as an engineer by exploring it. 🎉
Remember that:
"Writing code
? That's the easy
part.
Getting your application in the hands of users,
and creating applications that people actually want to use - now that's the hard stuff." ~ Jeff Atwood
Now for the "not nice" part:
When I asked you to create an issue for Multihash
it wasn't a suggestion.
Issues are how we keep track of the work that needs to be done. Without them it's chaos.
I don't like Chaos and I don't know any leader/entrepreneur who does.
If they say they do; they're either joking or lying. Chaos is the enemy of progress.
I say/write "Please" to be polite. But please don't confuse direct instructions for optional requests again.
It's not difficult to open an issue [5 mins] before spending a day [8 hours] on a tangental task. 💭
Create an issue before
you start the work
Here's the issue: dwyl/dart_multihash#1 it took me T5m
to create it.
My time is worth 20x
so 5 minutes
of my time is 100 minutes
of yours ... You're welcome.
As far as "bosses" go, I try
my best not to be an A55H0L3
but I've worked a few places where doing the exact opposite
of what the "boss" asks gets people fired on-the-spot. 🔥
Remote Work === Communication.
If you want to work in micro-team in an office on closed source software
where written communication isn't required, that's fine.
But if you want to work remotely, then communicating early and often is a MUST
, not optional.
I've worked on 200+ people remote teams and the engineers who ignore communication
get labelled as "Difficult to Work With" and get "let go" very fast. 🙅
I'm not saying this to be "mean" or "difficult", in fact the exact opposite is true!
As you know my goal is to help you grow and flourish as a person and engineer. 🚀
I expect
you to go on to do great things and work in super interesting places.
But the number of those places in PT/Porto is vanishingly small.
Which means you either need to move away from all your family, friends & creature comforts
to a big international city where you know nobody, have zero friends or family and will be miserable.
OR you have the "best of all worlds" and work remotely.
Your Time < My Time
Your "bosses" time will always be more valuable than yours.
In some cases it's "only" 5x
but if you work somewhere "big" like Google, it's 100x
.
Never waste your bosses time. Ever.
When you [eventually] become the "boss", e.g. when you start your own company.
You will want the people working for you to respect your time.
I sincerely hope you reach that point.
Because the alternative is mediocrity and nobody wants that. 😢
In the process of adding property-tests, akin to what's happening here -> https://github.com/dwyl/cid/blob/194d5e10d8713a6bce186d74021153ca43d5782a/test/cid_test.exs#L114
It's taking a wee of time to get it working the same, processes work a bit differently in Dart. But I should get it working today.
I kept README fairly simple because I didn't want to duplicate information from https://github.com/dwyl/cid
Good plan. thank you for being thorough. 👌
Finished IPFS tests based on what was done with dwyl/cid
-> #3 (comment)
Regarding documenting the process of publishing a package dwyl/learn-dart#22, I'm waiting for dwyl/dart_multihash#2 to be reviewed so I can publish it, properly use it on this repo instead of mocking.
@LuchoTurtle dwyl/dart_multihash#2 merged.
Please proceed. 🙏 (Thanks again!)
Just pushed the necessary changes with #3
Marked your comment as outdated by mistake, wanted to hide it to make scrolling easier but ended up making a mistake. Sorry about that.
Published
https://pub.dev/packages/dart_cid