# EPF Final Dev Update
It’s hard to believe, but we’ve reached the 21st week of EPF5. Over the last few months, I’ve had the opportunity to contribute meaningfully to Ethereum’s ecosystem. My journey began with a focus on custom libp2p implementation for Prysm but later transitioned to working on Nethermind’s libp2p implementation. Here’s a summary of my experience.
---
## Abstract
Initially, my project aimed to implement a **custom libp2p stack for Prysm**, focusing on enhancing its modularity and flexibility. This proposal can be found here: [Prysm libp2p Implementation Proposal](https://github.com/eth-protocol-fellows/cohort-five/blob/main/projects/Prysm_libP2P_Implementation.md). However, as my understanding of the ecosystem grew, I transitioned to contributing to Nethermind’s libp2p stack, where I worked on implementing key protocols like **Noise**, **Multistream**, **TLS**, and **PerfProtocol** for the .NET libp2p library.
---
## Contributions and Achievements
### 1. **Noise Protocol Enhancements**
I optimized the negotiation process by allowing **pre-selection of a muxer** during the handshake, leveraging Noise protocol extensions. This optimization reduced the latency in muxer negotiation.
- [PR: Optimize muxer selection during handshake](https://github.com/NethermindEth/dotnet-libp2p/pull/90)
- Added tests to validate successful and broken handshakes, ensuring protocol robustness.
---
### 2. **Multistream Protocol Updates**
The Multistream Protocol was updated to reflect the pre-selection changes introduced in the Noise Protocol, further streamlining the protocol negotiation process.
- [PR: Multistream Protocol Updates](https://github.com/NethermindEth/dotnet-libp2p/pull/94)
---
### 3. **TLS Protocol Implementation**
One of the most challenging yet rewarding parts of this journey was the implementation of the **TLS 1.3 protocol** for libp2p. This ensured secure and encrypted communication between peers.
#### Key Milestones:
- Successfully established connections between .NET clients and servers.
- Achieved cross-platform compatibility for Linux, macOS, and Windows.
- Enhanced `SslApplicationProtocols` handling to dynamically adapt muxer settings during runtime.
- [PR: TLS Protocol Implementation](https://github.com/NethermindEth/dotnet-libp2p/pull/104)
---
### 4. **PerfProtocol**
I developed a **Performance Protocol (PerfProtocol)** for measuring throughput and connection handshakes per second under varying conditions. Inspired by QUIC drafts, this protocol was adapted for libp2p with the following benchmarks:
- **Throughput**: Measuring data transfer speeds.
- **Handshakes per Second**: Assessing connection setup efficiency.
For security reasons, the protocol isn’t enabled by default and leverages peer authentication for restricted access.
- [PR: PerfProtocol Implementation](https://github.com/NethermindEth/dotnet-libp2p/pull/109)
---
### Challenges Faced
- **Cross-platform TLS support**: Overcoming compatibility issues across different operating systems.
- **Handshake failures**: Debugging and resolving errors in muxer negotiation and SSL stream initialization.
- **Performance optimization**: Balancing protocol flexibility with runtime efficiency.
---
## Future Work
#### 1. **Circuit Relay v2 Implementation**
- **Protocol**: `/libp2p/circuit/relay/0.2.0/*`
- **Details**: Circuit Relay v2 is a key libp2p protocol that enables relay-based connections for peers unable to establish direct connections due to NAT or firewall restrictions.
- **Stack**: Standard libp2p
- **Type**: Relay
- **Spec**: [Circuit Relay Spec](https://specs.libp2p.io/relay-v2/)
- **Next Steps**:
- Implement and test the Circuit Relay v2 protocol.
- Integrate with existing transport protocols and ensure seamless operation in the .NET libp2p stack.
- Optimize relay performance, focusing on latency and bandwidth efficiency for indirect peer connections.
---
#### 2. **KAD-DHT Enhancements**
- **Protocol**: Kademlia Distributed Hash Table (KAD-DHT)
- **Details**: KAD-DHT is critical for decentralized discovery and routing in libp2p. Its `findPeer` feature enables efficient peer discovery, essential for establishing end-to-end streams in distributed networks.
- **Stack**: Standard libp2p
- **Type**: Discovery, Routing
- **Spec**: [KAD-DHT Spec](https://github.com/libp2p/specs/tree/master/kad-dht)
- **Additional Context**:
- Explore integration of **Discv5** (used in the Ethereum Consensus Layer network) to provide enhanced peer discovery capabilities.
- Wrap Discv5 with an interface compatible with the .NET libp2p implementation to facilitate broader adoption.
- Address key issues in the current implementation. (Refer to the list of issues here: [Nethermind .NET libp2p Issues](https://github.com/NethermindEth/dotnet-libp2p/issues/)).
---
#### 3. **Performance Optimization**
- Further optimize the protocols for reduced latency and efficient resource usage, particularly focusing on:
- **Relay protocols**: Minimize overhead in relayed connections.
- **DHT lookups**: Enhance lookup efficiency to reduce time-to-discovery for peers.
- Extend benchmarking capabilities using the **PerfProtocol**, adding more granular metrics for throughput and latency in various scenarios.
---
## Feedback on EPF
Participating in EPF has been an incredible experience. It provided me with the opportunity to contribute to Ethereum’s core ecosystem while learning from mentors and peers across the globe. I’ve grown both technically and personally, gaining a deeper understanding of how decentralized systems operate and how to collaborate effectively in open-source environments.
Special thanks to my mentor, **Alexey**, for his guidance and patience throughout this journey. A huge shoutout to **Josh** and **Mario** for organizing such a fantastic program.
For anyone considering contributing to Ethereum core development, EPF is an excellent platform. Whether you’re officially selected or join permissionlessly, it’s an experience that’s worth every moment.
---
Thank you all for following my journey.
Rose