Repository navigation
How to get same CID as web3.storage? #2231
Unanswered
helloivanco
asked this question in
Q&A
Replies: 2 comments
|
you have to use the same merkle dag creation parameters for this. I have a related article on this - https://moskud.xyz/cids The steps are:
Wherever you generate the car file, if you can use the same parameters, you are set. You can try to unpack the code here - https://github.com/covalenthq/ipfs-pinner/blob/main/binary/main.g,o Let me know if this helps. |
0 replies
|
Thank you for following up! These parameters worked: I ended up making this npm package which takes a file buffer and returns the proper CID. https://www.npmjs.com/package/ipfs-web3storage-cid |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
By using the Multiformats library, I'm able to get the same CID for files under 1MB with this function. However, for files greater than 1MB it is returning a different CID.
I've also tried to packToBlob with ipfs-car but get much different CIDs.
Any help figuring this out would be appreciated. Btw, a simple function or library to determine the CID v1 of a file would be a useful tool to prevent filename collisions and sets one up for content addressing.
All reactions