esnes-fqaaa-aaaad-qd55q-cai.icp0.io Open in urlscan Pro
2a0b:21c0:b002:2:5000:53ff:feb3:7feb  Public Scan

URL: https://esnes-fqaaa-aaaad-qd55q-cai.icp0.io/whats-in-a-cid-multi-multi-multi/index.html
Submission: On December 22 via api from US — Scanned from CH

Form analysis 4 forms found in the DOM

GET http://OFFLINEZIP.wpsho/

<form method="get" id="searchform-toggle" action="http://OFFLINEZIP.wpsho/">
  <label for="s" class="assistive-text">Search</label>
  <input type="search" class="txt-search" name="s" id="s">
  <input type="submit" name="submit" id="btn-search" value="Search" style="display: none;">
</form>

GET http://OFFLINEZIP.wpsho/

<form method="get" id="searchform-movil" action="http://OFFLINEZIP.wpsho/">
  <label for="s" class="assistive-text">Search</label>
  <input type="search" class="txt-search-movil" placeholder="Search..." name="s" id="s">
  <input type="submit" name="submit" id="btn-search-movil" value="Search">
</form>

POST http://OFFLINEZIP.wpsho/wp-comments-post.php

<form action="http://OFFLINEZIP.wpsho/wp-comments-post.php" method="post" id="commentform" class="comment-form">
  <p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> Required fields are marked <span class="required">*</span></p>
  <p class="comment-form-comment"><label for="comment">Comment</label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea></p>
  <p class="comment-form-author"><label for="author">Name <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" required="required"></p>
  <p class="comment-form-email"><label for="email">Email <span class="required">*</span></label> <input id="email" name="email" type="text" value="" size="30" maxlength="100" aria-describedby="email-notes" required="required"></p>
  <p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="text" value="" size="30" maxlength="200"></p>
  <p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment"> <input type="hidden" name="comment_post_ID" value="91" id="comment_post_ID">
    <input type="hidden" name="comment_parent" id="comment_parent" value="0">
  </p><input type="hidden" name="js-spam-prevention" value="071ea99d84f09974a5406258d0e8867b">
</form>

POST

<form id="mc4wp-form-1" class="mc4wp-form mc4wp-form-80 mc4wp-form-theme mc4wp-form-theme-blue" method="post" data-id="80" data-name="Subscribers Form">
  <div class="mc4wp-form-fields">
    <p>
      <input type="text" name="FNAME" placeholder="First Name" required="">
    </p>
    <p>
      <input type="email" name="EMAIL" placeholder="Email Address" required="">
    </p>
    <p>
      <input type="submit" value="SUBSCRIBE!">
    </p>
  </div><label style="display: none !important;">Leave this field empty if you're human: <input type="text" name="_mc4wp_honeypot" value="" tabindex="-1" autocomplete="off"></label><input type="hidden" name="_mc4wp_timestamp"
    value="1587339296"><input type="hidden" name="_mc4wp_form_id" value="80"><input type="hidden" name="_mc4wp_form_element_id" value="mc4wp-form-1">
  <div class="mc4wp-response"></div>
</form>

Text Content

Search
Search
 * Home
 * Contact



Skip to content
 * Home
 * Contact


WHAT’S IN A CID? MULTI, MULTI, MULTI…

TheCodeClimber    April 13, 2020 April 13, 2020    No Comments on What’s in a
CID? Multi, Multi, Multi…


Every piece of data on IPFS can be referenced through its CID, which stands for
Content IDentifier. You might have have spotted some while navigating the IPFS
jungle. They look like this: Qmd286K6pohQcTKYqnS1YhWrCiS4gz7Xi34sdwMe9USZ7u and
this QmYf4sT9KbtW3ZCKoX8DdgJy9tDKVAUjbPTBi525RNR29V. And also this:
bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi.


But what are they made of? How to understand their composition? CIDs are said to
be multihash, multicodec and multibase.
Multi-what? In this short article, we’ll explain each of those terms so you can
better understand CIDs.


CIDs are… Multihash
As has been explained on a previous article, IPFS uses cryptographic hashes to
identify data. Cryptographic hashes are in essence mathematical formulae that
create a unique fingerprint for a data.


A popular cryptographic algorithm to generate such hashes is SHA2-256. SHA2-256
creates a hash of a length of 256 bits. It’s awesome and very useful today, but
will it still be useful 10 years from now, when computing devices will become
more powerful and where maybe quantum computing renders this particular
algorithm useless?

This scenario is not not completely unheard of since some hash functions, such
as MD5 and SHA-1, were eventually rendered useless.

So which algorithm should IPFS use, knowing that eventually the algorithm could
be broken? The solution is to use a multihash.


The multihash is very simple. It consists of an identifier for the hashing
function used, the length of the hashing function and then the hash itself.

The hashing function used is determined thanks to a table that everyone agrees
on, where we assign a number to all possible hashing funtions.

So the multihash ends up looking like this:
In the case of a SHA2-256 hash, this is <256 bits in length><001010101010…>.

Awesome! Now our content identifiers are future-proof! If we want to change the
hashing function, we can!

But what if we could get a little more information from our CID? Like what the
data represents?

That where the next part comes in…

CIDs are… Multicodec

We want to add more information to our CID so that we may have a better idea of
the type of data. Is it a JSON data? CBOR? Something else?

So what we will do is very simple, we’ll just add more data in front of our
multihash which will describe the codec according to a table. This works in the
same manner as the identifier of the hashing function for the multihash.

So now, our CID looks like this:


The CID is just a long series of bits that are self-describing. First, the
multicodec which describes the type of the data. Then, the multihash, as
explained earlier.

But there’s more…

CIDs are… Multibase
Originally, IPFS CIDs were described in base58 which is the same base which
encodes bitcoin addresses.
But of course, we could be using all kind of bases such as base 32 so, once
again, we need to add more data in front of our CID. We now add the multibase,
which just tells us the base which will encode the CID.

base()

Okay, so that’s it with prefixing data, right? We are done?

No… We need to do some history about CIDs first, before we can understand the
last bit of information to add.

V1 vs V0

At the beginning of IPFS, there weren’t multibases or multicodecs. All the CIDs
were multihashes only.
We call those CIDs version 0. Then later, the IPFS project decided to improve
the CIDs and add the multicodec and the multibase also. And thus Version 1
replaced Version 0.

So how do we differentiate between Version 0 and Version 1 CIDs? How do we tell
if a CID is of an upcoming hypothethical version 2? Or even version 3?

That’s why from Vversion 1 and onward it was decided to add the Version to all
CIDs. We will now put it right after the multibase.
So now CIDs look like this:

base()

BAFY vs Qm

To help you synthesise this information, here’s an awesome tool that will allow
you to analyse CIDs and each of their components: https://cid.ipfs.io/

What I want you to do is to plug this version 0 CID in the tool:
Qmd286K6pohQcTKYqnS1YhWrCiS4gz7Xi34sdwMe9USZ7u

As you might notice, the multicodec and the multibase is implicit. Why is that?
Because they didn’t exist for version 0 CIDs! Therefore, we just assume what
they are.

At the bottom of the page, you will see a hash starting with bafy... this hash
is the equivalent CID for version 1. A neat trick to differentiate v0 and v1
CIDs is to look at the first letters. If it starts with Qm, it is probably a v0
CID. If it starts with bafy, it is probably a v1 CID.

Finally, plug this version 1 CID into the tool:
bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi.

The tool with now show us the base and codec according to the format described
above.

Congrats!

Congrats! You are now a master of CIDs! You understand the ins and out of IPFS
CIDs and can describe each component.

General   



POST NAVIGATION

Automate your Builds on Docker Hub by Writing a Build Hook Script!
How to Visit ENS-enabled Websites! Your Gateway to Web3


LEAVE A REPLY CANCEL REPLY

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website




SUBSCRIBE BY EMAIL!



Leave this field empty if you're human:

Copyright 2020

Ribosome by GalussoThemes.com
Powered by WordPress