As described in IPFS white papaer, all the data in IPFS is organized in a DAG where each object can be associated with links and links can have names. But I found something weird when I run following commands to explore some DAG objects.
ipfs object get QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco
It is basically fetching the root object of wikipedia snapshot. Here is the result:
{"Links":[
{"Name":"0C-","Hash":"QmPQVLHXAcDLvdf6ni24YWgGwitVTwtpiFaKkMfzZKquUB","Size":237360},
{"Name":"43I","Hash":"QmNYBYYjwtCYXdA2KC68rX8RqXBu9ajBM6Gi8CBrXjvk1j","Size":44323016540},
{"Name":"58wiki","Hash":"QmehSxmTPRCr85Xjgzjut6uWQihoTfqg9VVihJ892bmZCp","Size":613715579624},
{"Name":"92M","Hash":"QmaeP3RagknCH4gozhE6VfCzTZRU7U2tgEEfs8QMoexEeG","Size":826},
{"Name":"A0index.html","Hash":"QmdgiZFqdzUGa7vAFycnA5Xv2mbcdHSsPQHsMyhpuzm9xb","Size":165}],
"Data":"\u0008\u0005\u0012\u0015\u0001\u0000\u0004\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0000\u0000\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0010\u0000(\"0ďż˝\u0002"}
What’s weird is that the names are prefixed with some numbers, eg. “58wiki”
I know there is a directory called “wiki” under this hash but what is that prefix “58” ?
If I run:
ipfs ls QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco
then I get:
QmPQVLHXAcDLvdf6ni24YWgGwitVTwtpiFaKkMfzZKquUB 237360 -
QmNYBYYjwtCYXdA2KC68rX8RqXBu9ajBM6Gi8CBrXjvk1j 44323016540 I
QmehSxmTPRCr85Xjgzjut6uWQihoTfqg9VVihJ892bmZCp 613715579624 wiki
QmaeP3RagknCH4gozhE6VfCzTZRU7U2tgEEfs8QMoexEeG 826 M
QmdgiZFqdzUGa7vAFycnA5Xv2mbcdHSsPQHsMyhpuzm9xb 165 index.html
As you can see, the names are not prefixed by numbers.
Furthermore, if I run:
ipfs resolve QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki
It cannot resolve the path because it cannot find a link named “wiki”:
Error: no link named "wiki" under QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco
But if I change “wiki” to “58wiki”, it works.
So the prefix seems really matters, but my question is that what does the prefix mean? and how it is calculated.
This bothers me because I can get the content directly by “ipfs cat QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki/index.html”,
but I can’t resolve the path by “ipfs resolve QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco/wiki/index.html”