RFC: Iroh [Noise] Connection #1935
EthnTuttle
started this conversation in
Ideas
Replies: 1 comment
-
|
TABConf/7.tabconf.com#83 https://fountain.fm/episode/bq98jfdTbReOt9dHZqAu |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Iroh is in use by https://github.com/fedimint/fedimint and has https://docs.rs/iroh/latest/iroh/ for Rust.
Iroh removes DNS as a dependency for Stratum v2 mining pools.
Overview
This design integrates Iroh peer-to-peer networking as an alternative transport layer for Stratum V2 connections by extending the network-helpers crate. Iroh replaces TCP at the transport layer while maintaining full compatibility with existing channel management logic and providing the same connection interfaces.
The key insight is that Iroh serves as a drop-in replacement for TcpStream, allowing us to maintain the existing layered architecture:
All connection types return the same
(Receiver<StandardEitherFrame<Message>>, Sender<StandardEitherFrame<Message>>)interface, ensuring zero changes are needed in channels-sv2 or any higher-level code.Architecture
Transport Layer Replacement
graph TB subgraph "Channel Layer" CHAN[All Channels<br/>ExtendedChannel, StandardChannel, GroupChannel] end subgraph "Network Helpers Layer" NC[Connection::new<br/>TCP + Noise] PC[PlainConnection::new<br/>Plain TCP] IC[IrohConnection::new<br/>Iroh + Noise] PIC[PlainIrohConnection::new<br/>Plain Iroh] end subgraph "Stream Layer" NTS[NoiseTcpStream] NIS[NoiseIrohStream] end subgraph "Transport Layer" TCP[TcpStream] IROH[Iroh BiStream] end CHAN --> NC CHAN --> PC CHAN --> IC CHAN --> PIC NC --> NTS IC --> NIS PC --> TCP PIC --> IROH NTS --> TCP NIS --> IROHKey Design Principles
Components
NoiseIrohStream
Equivalent to NoiseTcpStream but using Iroh as the transport layer:
IrohConnection
Equivalent to noise_connection.rs but using NoiseIrohStream:
PlainIrohConnection
Equivalent to plain_connection.rs but using Iroh directly:
IrohNodeManager
Manages Iroh node lifecycle and configuration:
Transport Selection Matrix
Connection::new()(Receiver, Sender)PlainConnection::new()(Receiver, Sender)IrohConnection::new()(Receiver, Sender)PlainIrohConnection::new()(Receiver, Sender)Usage Patterns
In Roles
Roles choose transport by selecting the appropriate connection constructor:
Client-Side Configuration-Based Selection
Server-Side Dual Transport Support
Servers can listen on both TCP and Iroh simultaneously (no fallback):
Error Handling
Iroh-Specific Errors
Client-Side Transport Fallback
Fallback only applies to clients establishing outbound connections:
Implementation Strategy
Phase 1: Core Iroh Transport
Phase 2: Node Management
Phase 3: Role Integration
Phase 4: Production Features
Beta Was this translation helpful? Give feedback.
All reactions