Open Source P2P Network Built on Nym Mixnet

I’m working on a Bitcoin-inspired peer-to-peer network, that use Nym Mixnet for nodes communication, It is not tied to any specific application but serves to illustrate potential capabilities. The source code incomplete at the moment and can be found on valansai/peer-to-peer · GitHub, Its build using nymlib that previously I announced here Nymlib Rust workspace designed to make it easier to build applications on top of the Nym mixnet

Each node can send and receive messages, track connected peers, and handle both identified and anonymous participants. Nodes automatically manage handshakes, message queues, and periodic keepalive checks to maintain a resilient, reliable network.

Peers are represented by a custom “Address”, which can be a real Nym address or an anonymous tag, allowing seamless handling of both public and private communications. Nodes expand the network organically by connecting to known peers, exchanging addresses, and integrating new nodes discovered through messages.

  • Open Connections: Maintain a list of peer addresses, perform handshakes using version and verack messages, and periodically attempt connections, allowing the network to grow dynamically.
  • Message Sending & Listening: Send queued messages and collect incoming messages at regular intervals.
  • Message Processing: Handle messages intelligently, including version, verack, addr, and getaddr.
  • Keepalive (Ping/Pong): Ensure active connections and remove unresponsive nodes.
  • Expand Connections (Addr/GetAddr): Request peer addresses to grow the list of known peers.
  • Anonymous Participation: Nodes can interact without revealing their own Nym address.

For anyone interested in exploring ideas, contributing, or testing, check out the GitHub link mentioned above. Feel free to ask questions here, open issues on github.


5 Likes

P2P Over the Mixnet is ready for testing, It’s a peer-to-peer network inspired by Bitcoin’s architecture, but instead of plain sockets, it runs on top of the Nym mixnet. That means traffic can flow currently between identified participants via their nym address, and soon between identified participants and anonymous participants without breaking the mesh. Nodes know how to handshake version/verack, exchange addresses ADDR/GETADDR, push messages, and expand the swarm on their own.

Visit GitHub - valansai/peer-to-peer to go throw the source code., and read more, theres a guide about how to spin up a small swarm on your own machine. Four nodes, all linking up through the mesh..

As noted on GitHub, once anonymous connections, ping checks, and dead-node detection are implemented, we’ll be ready to take the network public. You’ll be able to run your own node, share your address, and link up with others—watching the mesh expand, messages flow, and the swarm come alive in real time. It’s hands-on, it’s experimental, and each round of testing will help to improve it.

Anyone is free to take parts of the code and use it as they wish — fork it, adapt it, build their own project on top of it. This is meant as an open starting point for experimentation on the mixnet, not a closed system.

Any thoughts or feedback are welcome even small suggestions or gentle critique.

3 Likes

Great project, me thinks. However, have you ever looked into the Bitmessage (Python2) P2P Network, for more inspiration? I ask, because Bitmessage makes
it quite easy to connect to other peers and users do not have to use connection
parameters to reach each other. Additionally Bitmessage has public/hidden chans (channels), similar to Usenet Groups, which users can create and join. Bitmessage has also SOCKS5 support, so that it can be used with the nym-socks5-client and nym-network-requester (set as open relay) Here is the URL: Bitmessage/PyBitmessage: Reference client for Bitmessage: a P2P encrypted decentralised communication protocol:

1 Like

Hi, Thanks for your words. I’m aware of it, though I’m not very familiar with its protocol, so I’ll definitely take a closer look. The network runs entirely inside the Nym mixnet, so separate requester or proxy processes aren’t required for internal messaging, each node have its own Nym client. Using nym-socks5-client or nym-network-requester would only be necessary if we want nodes to reach clearnet services.

Hi, I understand that your program does not need a proxy or requester. I only mentioned Bitmessage, because it uses bootstrap servers in it code which means that you always connect to the network and I believe if we had Nym bootstrap nodes it could make connections a bit easier to get the latest messages. Well, just a thought.

Now, Anonymous nodes can now participate in the network without revealing their Nym addresses to other nodes.

1 Like