|
| 1 | + |
| 2 | + |
| 3 | +# RIW2021|RFC: ZK-friendly IPLD data model |
| 4 | + |
| 5 | +_Status:_ <**draft**; **~~ready for review~~**; **~~ready to publish~~**> |
| 6 | + |
| 7 | +_Area of Improvement:_ < Data Delivery Metering | Distribution Graph Forming | Opportunistic Deployments | Cryptoeconomics > |
| 8 | + |
| 9 | +_Estimated Effort Needed:_ <?> |
| 10 | + |
| 11 | +_Prerequisite(s):_ <?> |
| 12 | + |
| 13 | +_Priority:_ <? P0, P1, P2> |
| 14 | + |
| 15 | + |
| 16 | +### Abstract |
| 17 | + |
| 18 | +Verifying a CID for a full IPLD data model can be complex and computationally extensive. Building an ZK-compatible IPLD data model, would allow the inclusion of a ZK proof of the CID avoiding the verification computation. Using ZK-compatible hot copies for 3DMs would increase the ability of generating proofs, benefiting the design of the client metering protocol. |
| 19 | + |
| 20 | + |
| 21 | +### **Proposal/Construction** |
| 22 | + |
| 23 | +In order to verify data structures inside a SNARK, the computations that have been done to calculate the hash has to be redone inside the SNARK. Currently IPLD does not use SNARK friendly hash functions, nor repeatable data structures in many places. For instance, any change in the structure of building the Merkle Tree or how the hash of a file is constructed means writing a new SNARK circuit, increasing complexity and cost. A large part of decisions on data structures for hashing and hash functions in Filecoin have been designed to work well with SNARKs. |
| 24 | + |
| 25 | +This RFC proposes the design of ZK-compatible IPLD structures so proofs can be embedded on IPLD structures. This is a complementary proposal that may benefit the design of other constructions and protocols of 3DMs. |
| 26 | + |
| 27 | +IPLD -> Raw bytes -> Encrypt data -> Merklize with Poseidon Hash -> ZKCP protocol proof -> Decrypt -> Generate IPLD -> Verify |
| 28 | + |
| 29 | +**Impact** |
| 30 | + |
| 31 | +It makes hot copies in 3DMs ZK-ready, opening the door to the design of proof-based protocols. |
| 32 | + |
| 33 | + |
| 34 | +### Pros and Cons |
| 35 | + |
| 36 | +**Pros** |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +* Creates a data model in which generating proofs is easier than in the current IPLD model. |
| 41 | +* Eases the construction of protocols that require proof over the data in the retrieval network. |
| 42 | +* It has been done successfully in Filecoin. |
| 43 | + |
| 44 | +**Cons** |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +* Requires changes over the current IPLD structure. |
| 49 | +* It may be hard to impose all the data served through the retrieval network to follow this structure. Additional encoding may be required to serve the data in this format into the network. |
| 50 | + |
| 51 | + |
| 52 | +### **Implementation **n**otes** |
| 53 | + |
| 54 | +<If possible, some pointers on how to implement the proposal> |
| 55 | + |
| 56 | + |
| 57 | +### **Evaluation** |
| 58 | + |
| 59 | +Generating proofs and validating data in IPLD structures can be done in an efficient way. |
| 60 | + |
| 61 | + |
| 62 | +### Prior work |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +* [Filecoin Merkle Proofs](https://spec.filecoin.io/#section-algorithms.sdr.merkle-proofs) |
0 commit comments