# Polynomial commitments, KZG and the necessity of EIP4844 --- ## Agenda - ZkSnark = Commitment + IOP - But what are commitment schemes? - Various form of commitments imply costs on ZK - Polynomial "balance" - Constraints to polynomials - Why KZG became the hot thing? - KZG in etherum --- ## Zk ~= Commitment + IOP - ZK is a form of communication when you can't decide if Alice talked to herself or to Bob, no matter how long you investigate the dialoge. - The "snark" part also makes this fast, small and one-shot. - It's a trend in crypto engineering to create new ZKSnarks by combining commitments and IOPs - It's not the **only** way to do it, but it works all the time if you have both components ready, and it's easy to model --- ## Commitment schemes - Appeared first in a thought experiment "coin tossing over phone". - You need an encoding of your **secret** data in a way that you cannot **change your mind** when it's time to decide who won. - Formally these are the **binding** and **hiding** requirements --- ## Commitment hierarchy in ZK ![](https://kroki.io/plantuml/svg/eNptkUEKwjAQRfc9xeDORXsAF6WIIEGFYMGFu9CMpZgmMk0Rb29sqk1aV5n5f5iflxSdFWT7ViWElRW6VgirEu0q7C-uNBRJR_OEHdaEGMncqJc2bSNUJDOtkYCTkX3lVofWuWQlbNbR-Anp7k473860RXoYJWyja-hmtzxc91G_7ZVC60LNDRjnLtZxQSrTHDxQ4g8vRURh4-0JLJlKyGSWL-mGGPrs_MF9kwY1woujBv8PZviw49SAO8serQV5gVq6P34DpgCgRw==) --- ## Polynomial $94x_1^{4} + 16x_2^3 - 20x_3 + 3$ or $\sum_{i=0}^{4} c_ix_i^i$ or $(94, 16, 0, -20, 3)$ --- ## Polynomial - they can encode an enormous amount of data - they also encode enormous amount of RELATIONS between data $A(x) + B(x) = C(x)$ - they can express everything that is computable \o/ --- ![](https://i.imgur.com/Jr6WAQW.png) $x_2*(x_1+x_2)*(x_2+1)$ --- ## Why KZG is special? - Fixed commitment size (48 bytes), regardless of how long is your "equation" - Fixed proof size too! - Fixed time verification, just 2 operations! - Multiple proofs can be squeezed into one -> sounds like a rollup! :rolled_up_newspaper: --- ## Ethereum and KZG - Storage is still the most expensive resource in web3 (contrary to IT in general) - Storing commitments, even if just 48 bytes, cost a lot of gas (2100 per byte) - But we nee lots of these if we were to create ZK layer2 dApps --- ## So we made a storage layer just for KZG :shrug: From EIP4844, a separate layer is introduced that ONLY stores KZG commitments, cheaply, and deletes them after 2 weeks... you gonna verify them by that time anyway. --- ## Rules of the new layer - New type of transaction, only to be used if you want blobs - Not really sharded, but only synced by consensus nodes (prism, not geth) - Contracts cannot read directly, only the commitment - On the long term, sharding will be limited per block, so it **has it's own fee market** - New precompile contracts to verify proofs --- ## Layer2 after EIP4844 (the scroll way) - You made $T$ transactions off-chain that you need to anchor back to L1 for the fraction of the gas - Make a KZG commitment you T (remember you cannot change this later) - Make another KZG commitment to the circuit that gets executed inside EVM when you feed it these transactions - Evaluate both equations at the same point and check if they equal all the time --- ## The Future - DankSharding is only the first, forward-compatible step for real sharding - You still store all the blob transactions, but prune them frequently - Fee market experiments can run ahead of time and toolchain can mature before the real thing --- ## Thanks for your attention! Questions? https://silur.me @silur@infosec.exchange https://t.me/huohuli ![](data:image/gif;base64,R0lGODlhlACUAJEAAAAAAP///wAAAAAAACH5BAEAAAIALAAAAACUAJQAAAL/jI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTFPAjef6zkM59lvwdIigYohMAmzKprHxZN4YzSKO6sxKs0rf9RI9VMXfI3csOaOh5UrYsH4H1N2J3DsVtofYvNk/12PXtlUIRkgGyKcHaKUomIYY2fhwVykZ+LjTt8TYCQcZYekwmlDKiZpI5JkKujlIOfkpulfnOrsoW3rmiFub1Gt4m5vp+6qL2Rv3a4wUDNtM/ESMt0rK9XyrHHqqun1c/D1bvYvtfT7MncyqKs2cHX4IPq2u6YxOa+9uD9/9Zx0vHb929cZd0lew3zt5AOnNY7bP4DWEDwdqw7fFYbSF/wIbrvsnTqO4kQTBtQrIhqLHWCk3VnQJM+RHlOVUioQm02IxjTxDnawJ86asnM1IdiRaDd5PWyiTMjS6cybSkvcuWvDXFCdVqOQKLmPpdOjTrWSRvfwqMV/ak8KiqszolSlWpQfpJMQnlCZHvTbtwrW7N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P3uJHuzqJkF7G8uDpxtU4uhmQesUT2/8Gp0IGBmhyZQNhoCrIuhxmEHh/G1vmtKbD8nmvhhYL3/YCaMRvpVB4HHxceGiYv+NJS13PWd/yNBfF599FkIlbFN/7JNYxxAXQWju62Bcdl681wUpp6qviGfu3RC8CroFSFKHz/KeYm8GuanWslevCSMA8PmqIaBMgGNNYxhj+rH1TZN8fEQnHNZ5QeACEFxL7GJ49Yu91pLMeIGfWRdy1TVpBZKTFZJYlXt1tj1RTYrxSh6jLJbKTnLPdB0/pKFmSsZVjoZYkUTa6QDIOYpVc4CLpKEwfslCOPtwfy+5WSjI6kJCXSR/5TFlCC8JvhLiCXDCV2cNpmtKPvHPkNlmDznSqc53sbKc73wnPeMpznvSspz3vic98ZqAAADs=)
{"metaMigratedAt":"2023-06-17T20:43:31.035Z","metaMigratedFrom":"Content","title":"Polynomial commitments, KZG and the necessity of EIP4844","breaks":true,"contributors":"[{\"id\":\"f4d4af67-750e-4c99-b33e-c04b6d99a6c6\",\"add\":6034,\"del\":294}]"}
    222 views