# Week 1: Understanding the Rust KZG Library and Tutorial Development
This week, I started building a new, in-depth tutorial for the Rust KZG library. The project's goal is to create a comprehensive guide for developers, and you can follow my progress here: [https://github.com/only4sim/rust-kzg-tutorial](https://github.com/only4sim/rust-kzg-tutorial).
I will write the Chinese version first and translate them to English and other languages after initial test.
My first week was focused on two main tasks: getting a deep understanding of the library's architecture and writing the first chapter of the tutorial.
## Understanding the Library's Design
I began by exploring the architecture of the Rust KZG library. It’s impressively designed with a flexible multi-backend system. By using Rust's traits, the library abstracts the core cryptographic operations, allowing different backends like BLST or Arkworks to be plugged in. This approach is great for optimizing performance and ensuring the library can adapt to new cryptographic methods in the future.
The library also uses the Rayon framework to handle computations in parallel, which is essential for processing the large amounts of data required in systems like PeerDAS.
## Structuring and Writing the Tutorial
With a solid grasp of the library, I planned out the tutorial's structure. I've outlined an 18-chapter learning path that will guide users from the mathematical fundamentals of cryptography to advanced implementation techniques and even contributing to the ecosystem.
I also completed the first chapter, **"Cryptographic Foundations."** This chapter introduces the core concepts that everything else will build on, including:
* **Elliptic Curve Cryptography**: I created practical code examples to demonstrate basic operations on the BLS12-381 curve.
* **Pairing-Based Cryptography**: I explained how bilinear pairings work and why they are so important for the schemes we'll be using.
* **Polynomial Commitment Schemes**: I laid the groundwork for understanding KZG commitments by starting with simpler concepts like Pedersen commitments and showing the power of their homomorphic properties (e.g., `Commit(f1) + Commit(f2) = Commit(f1 + f2)`).
A key part of this chapter is connecting these abstract mathematical ideas to their concrete use in Ethereum's data availability layer, showing how data blobs introduced in EIP-4844 are turned into polynomial commitments.
## Week 1 Achievements
* **Solidified Project Plan:** Created a detailed 18-chapter [outline](https://github.com/only4sim/rust-kzg-tutorial/blob/main/docs/TUTORIAL_OUTLINE.md) for the tutorial.
* **Completed Chapter 1:** Wrote the [first tutorial chapter](https://github.com/only4sim/rust-kzg-tutorial/blob/main/docs/chapter01_cryptography_basics.md), complete with code examples covering the essential cryptographic background.
* **Understood Core Architecture:** Gained a strong understanding of the Rust KZG library’s flexible and high-performance design.
## Next Steps
For next week, I plan to dive into the mathematics of the KZG scheme itself for Chapter 2, including the details of the trusted setup. I'll also begin developing a set of test cases to accompany the educational content.
***
## References and Further Reading
1. **BLST GitHub Repository** (`supranational/blst`): A high-performance, C-based library for BLS12-381 signatures with official Rust bindings, used as a core backend in many Ethereum projects. [https://github.com/supranational/blst](https://github.com/supranational/blst)
2. **Arkworks GitHub Repository** (`arkworks-rs`): A comprehensive Rust ecosystem for designing and implementing zero-knowledge succinct non-interactive arguments (zkSNARKs). [https://github.com/arkworks-rs](https://github.com/arkworks-rs)
3. **Rayon Crate Documentation**: The official documentation for Rayon, a data-parallelism library for Rust that makes it easy to convert sequential computations into parallel ones. [https://docs.rs/rayon/latest/rayon/](https://docs.rs/rayon/latest/rayon/)
4. **EIP-7594: PeerDAS Specification**: The official Ethereum Improvement Proposal for Peer Data Availability Sampling (PeerDAS), which builds upon the foundation of EIP-4844. [https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7594.md](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7594.md)
5. **EIP-4844: Proto-Danksharding**: The official documentation for EIP-4844, which introduced blob-carrying transactions and KZG commitments to significantly lower data storage costs for Layer 2 rollups. [https://www.eip4844.com/](https://www.eip4844.com/)