# Week 2: Tutorial Development and Practical Implementation
Following the plan from last week, I continued developing the tutorial for the Rust KZG library. You can track all progress and see the latest files at the project repository: [https://github.com/only4sim/rust-kzg-tutorial](https://github.com/only4sim/rust-kzg-tutorial).
This week's focus was on bridging the gap between theory and practice. I finalized the overall tutorial structure and wrote Chapter 10, a hands-on guide designed to get developers running their first KZG program as quickly as possible.
The reason to skip the other chapters and start with Chapter 10 is tutorial consistency. The Chapter 10 will define the structure of the development.
## Finalizing the Tutorial Structure
I finished designing the comprehensive 18-chapter tutorial structure. The curriculum is broken down into six major parts, guiding a developer from the mathematical basics all the way to advanced performance optimization and contributing back to the ecosystem. It includes flexible learning paths for different experience levels, from a beginner track focusing on core concepts to an expert track that covers the entire library in depth.
## Creating a Hands-On Guide (Chapter 10)
The main achievement this week was completing **Chapter 10: "Environment Setup and Basic Usage."** This chapter is the crucial first step for any developer wanting to use the library. It provides everything needed to go from zero to a fully functional KZG implementation.
The chapter covers:
* **Environment Setup**: Clear instructions on setting up the Rust toolchain, cloning the project, and compiling the necessary components.
* **Project Structure**: A breakdown of the `rust-kzg` workspace, explaining the roles of the core crates, backends (BLST, Arkworks), and examples.
* **"Hello KZG World" Example**: A complete, commented code example that walks through the entire KZG workflow:
1. Loading the trusted setup file.
2. Creating a sample data blob.
3. Generating a KZG commitment.
4. Computing a proof for the blob.
5. Verifying the proof.
* **Debugging and Troubleshooting**: Practical solutions for common issues, such as build errors or the dreaded "Invalid Scalar" error that can occur when creating field elements. It also includes tips for using a debugger and structured logging.
* **Performance Benchmarking**: A simple framework to measure the time it takes to perform commitment, proof generation, and verification, giving developers a feel for the real-world performance characteristics.
## Week 2 Achievements
* **Finalized Tutorial Architecture:** The full [18-chapter tutorial outline](https://github.com/only4sim/rust-kzg-tutorial/blob/main/docs/TUTORIAL_OUTLINE.md) is now complete, providing a clear roadmap for learners.
* **Completed Chapter 10:** Wrote the [first practical guide](https://github.com/only4sim/rust-kzg-tutorial/blob/main/docs/chapter10_environment_setup.md), focused on environment setup and hands-on coding.
* **Developed Robust Examples:** Created a ["Hello KZG World"](https://github.com/only4sim/rust-kzg-tutorial/blob/main/examples/hello_kzg.rs) program that includes frameworks for debugging, testing, and performance analysis to accelerate learning.
## Next Steps
Next week, I will begin working on two new chapters simultaneously: **Chapter 2 (KZG Mathematical Foundations)** to continue the theoretical track, and **Chapter 11 (Advanced API Usage)**, which will explore batch operations, multi-backend performance comparisons, and other advanced features.
***
## References and Further Reading
1. **KZG Polynomial Commitments by Dankrad Feist**: An essential blog post that explains the mathematical foundations of the KZG commitment scheme. [https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html](https://dankradfeist.de/ethereum/2020/06/16/kate-polynomial-commitments.html)
2. **EIP-4844: Proto-Danksharding**: The official documentation for EIP-4844, which introduced blob-carrying transactions and the need for KZG commitments in Ethereum. [https://www.eip4844.com/](https://www.eip4844.com/)
3. **The KZG Ceremony (Ethereum Foundation Blog)**: An article explaining the purpose and importance of the trusted setup ceremony for EIP-4844. [https://blog.ethereum.org/2023/01/16/announcing-kzg-ceremony](https://blog.ethereum.org/2023/01/16/announcing-kzg-ceremony)
4. **EIP-7594: PeerDAS Specification**: The official Ethereum Improvement Proposal for Peer Data Availability Sampling, the successor to EIP-4844's design. [https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7594.md](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7594.md)
5. **BLST GitHub Repository** (`supranational/blst`): A high-performance, C-based library for BLS12-381 signatures used as a core backend. [https://github.com/supranational/blst](https://github.com/supranational/blst)
6. **Arkworks GitHub Repository** (`arkworks-rs`): A comprehensive Rust ecosystem for designing and implementing zkSNARKs, used as another backend. [https://github.com/arkworks-rs](https://github.com/arkworks-rs)