vacp2p/mix
PoC implementation of the logos anonymization network layer
Mix
⚠️ This repository is no longer maintained.Development has moved to nim-libp2p/libp2p/protocols/mix. Please refer to that implementation for the latest updates.
This repository contains the implementation of the Mix protocol, a custom protocol within the libp2p framework
designed to enable anonymous communication in peer-to-peer networks.
Overview
The Mix protocol leverages the Sphinx packet format to ensure sender anonymity and message unlinkability.
It routes messages through a series of mix nodes, effectively concealing the origin of the message.
This implementation is part of a broader effort to integrate anonymity into the libp2p ecosystem.
Note: This is a proof-of-concept, not production-ready code.
It serves as a foundation for further development and research into anonymous communication within libp2p networks.
It provides a basis for future development and invites community experimentation and contributions.
Key Features
- Sphinx Packet Format: Guarantees anonymity through fixed-size packets and layered encryption.
- Random Path Selection: Routes messages through randomly selected mix nodes.
- Pluggable Components: Allows for customizable spam protection, peer discovery, and incentivization mechanisms.
Installation
-
Clone the repository
git clone https://github.com/vacp2p/mix.git cd mix -
Install Dependencies
Ensure you have Nim and Nimble installed. For detailed installation instructions and downloads,
visit the official Nim website, where you'll find installers for various operating systems and methods.
Nimble, the package manager for Nim, is typically included with the Nim installation.
Then install the necessary Nim packages:nimble install
Running Tests
Execute the test suite with:
nimble test
Usage
Run the Mix protocol proof-of-concepts:
nim c -r examples/poc_gossipsub.nim
nim c -r examples/poc_resp_ping.nim
nim c -r examples/poc_noresp_ping.nim
Using experimental exit == destination
- Compile with:
-d:mix_experimental_exit_is_destination - In
toConnectionyou can now specify the behavior the exit node will have:`
# Exit != destination (the default)
# The exit node will forward the request to the destination
# You can also use MixDestination.init instead
let theDestination = MixDestination.forwardToAddr(thePeerId, theMultiAddress)
let conn = mixProto.toConnection(
theDestination,
theCodec,
).expect("should build connection")
# Exit == destination
# The protocol handler will be executed at the exit node
let theDestination = MixDestination.exitNode(thePeerId)
let conn = mixProto.toConnection(
theDestination,
theCodec,
).expect("should build connection")
Current Implementation Challenges
- Protocol Handler Diversity: Existing protocols have diverse input formats for handlers and send functions,
complicating the integration. - Function Call Complexity: Difficulty in calling Mix send/handler functions from existing protocols
without significant overrides to send functions (and handlers in some cases, e.g., ping).
Transport Approach
We have developed a custom Mix transport to address the challenges faced with the protocol-level implementation.
This approach aims to provide a more seamless integration with existing libp2p protocols.
For details on the Mix transport implementation, please refer to the mix-transport branch README.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
For major changes, please discuss your proposed changes via issue before making a pull request.
RFC and Further Reading
For a detailed technical specification and discussion, please refer to the Mix Protocol RFC.
License
- MIT License – see LICENSE-MIT or http://opensource.org/licenses/MIT
- Apache License 2.0 – see LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0
at your option.
Acknowledgments
Thanks to the libp2p community and all contributors for their feedback and insights throughout the development
of the Mix protocol.