Post
Share your knowledge.
Converting Filecoin CID to IPFS CID for ipfs:// Queries
I'm looking to understand the process of converting a Filecoin piece CID into a standard IPFS CID that can be utilized for ipfs:// queries. Can someone provide guidance or a method to achieve this conversion? Any insights or code snippets would be greatly appreciated.
- IPFS
- Filecoin
- IPLD
Answers
1Filecoin's piece of Content Identifiers (CIDs) differs from the CID of the IPFS files. IPFS files are segmented into a Merkle-DAG (Directed Acyclic Graph made of cryptographic Hashes). Filecoin utilizes Zero-Knowledge Proofs (ZKProofs) to ensure storage providers' accountability. These providers are required to submit daily proofs to demonstrate data retention; failure to do so results in collateral loss.
The ZKProofs function solely on blobs that are powers of two. Larger chunks are preferred due to various competitive factors. However, limitations exist due to GPU chip memory constraints, leading Filecoin providers to predominantly use 32 or 64 GiB chunks. Data padding is necessary for ZKProofs, with 1 bit added every 128 bits. Additionally, a truncated hash tree with specific properties is required.
In contrast, IPFS chunks range from 0 bytes (minimum) to 256 KiB (default) to 2 MiB (maximum). While functional, this size range is inadequate for Filecoin. Although padding can be applied to reach the next power of two, numerous small chunks are inefficient for storage providers.
Do you know the answer?
Please log in and share it.
The InterPlanetary File System (IPFS) is a protocol, hypermedia and file sharing peer-to-peer network for storing and sharing data in a distributed file system.