How to create an IPFS compatible multihash

前端 未结 5 1836
天命终不由人
天命终不由人 2020-12-30 07:00

I\'m trying to create an IPFS compatible mutihash but it is not matching. I am asking here because I have not yet found an example that takes this from hashing to the end r

5条回答
  •  囚心锁ツ
    2020-12-30 07:38

    A file in IPFS is 'transformed' into a Unixfs file, which is a representation of files in a DAG, in your example, you are hashing directly your multihash.txt with sha2-256, but what happens inside IPFS is:

    • file gets chunked into 256KiB pieces
    • each chunk goes into a DAG node inside a Unixfs protobuf https://github.com/ipfs/js-ipfs-unixfs
    • a dag is created with links to all the chunks.

提交回复
热议问题