Introducing: Mycelium

@smetl is working on a very exciting new project called Mycelium, our own Ipv6 overlay network. Thanks to him for taking the time to create this short write-up on what it is and why it is needed. Sometime soon we will also share a demo and we’ll continue to share more updates as we have them!

Introducing: Mycelium

As part of the grid, ThreeFold is also implementing a planetary network. This peer 2 peer network implementation aims to allow efficient, end-to-end encrypted communication with other participants on the network. Currently, we are using yggdrasil as the core technology for this network. This is an open source implementation, and we have been using this since of grid v2.

Over time, some problems have been noticed. We have since spent time looking into these issues, and performed an analysis of the root cause(s).

Yggdrasil’s Limitations

To start, it should be noted that Yggdrasil is an experimental routing protocol (based on DHT’s), which is currently still in an alpha stage. We very much admire the fact that they have been able to create a standalone network with worldwide participants from scratch. Over time, the network has grown, in part due to the grid, but also because a lot of individual participants joined and started running a node.

After investigating, we reached the conclusion that the current architecture has some scalability issues. While we have no doubt that these will eventually be solved, the importance of the planetary network in the grid is unfortunately too big to be able to wait for this. Additionally, Yggdrasil uses a technique called crypto key routing, and uses a tree structure for its routing info. This means data follows the “shortest path” in the tree, rather than the physical shortest path, which might deviate from this. As such, we have decided to implement our own Ipv6 overlay network, Mycelium.

Implementing Mycelium

As previously pointed out, the main goal of our network is to be efficient, and end-to-end encrypted. Every node in the network is identified by a key pair. The address of a node is derived from this key pair, and data traffic between 2 nodes is encrypted using a secret derived from the key pair of both these nodes. As a result, every 2 nodes in the system use a different secret for encryption, and we can verify that the address used by a node is indeed owned by it (i.e. it has the corresponding private key). We have based our initial implementation (loosely) on the babel routing protocol.

Therefore, sending data to a remote node will follow the shortest path in terms of latency (i.e. the fastest route). The network adjusts itself in case nodes disappear or join, and multiple paths to a given destination are possible.

We are also considering implementing more advanced use cases in the future, though this remains to be seen at this stage. We are gearing up for some larger scale testing on the grid in the near future (after all, we do have multiple thousand nodes at our disposal to verify scalability), and will adjust as needed once these are done.

7 Likes

This is very interesting indeed, congratulations @smetl, looking forward to hearing much more about it and to seeing how this develops

1 Like

Yes, looking forward to the demo! Will really put things into perspective.

Maybe needless to ask; currently i need to install an yggdrasil protocol and threefold connector on windows pc’s in order to get it to communicate. I assume this will be developed parallel?

Don’t use yydrassil. Use wireguard. It’s easier.

4 Likes

Great! I am very curious to see where this leads. Nice name too!

1 Like

I have made a video about WireGuard and ThreeFold if you need some guidens.

3 Likes

You will need to install some similar sort of app to connect to Mycelium. We may retool the TF Connector app for this purpose, but that remains to be seen. For now it’s available as a command line application for Linux only.

2 Likes

Thanks @smetl for your work on this cool project! And thanks @scott for yesterday’s presentation of Mycelium.

Mycelium seems to have a lot of potential to serve as backbone of various kinds of decentralized apps.

I read in the docs that a browser extension was planned for v0.5, so that inspired me to think about use cases of running Mycelium in web browsers. So, I would like to share my thoughts on that topic:

  • In future, If Mycelium can run in web browsers, that would offer an amazingly simple UX for the end users of decentralized web apps: no need to install software locally. It would also make the development of such dapps much simpler.

  • Running in the browser would require some of the routing logic to be written again in JavaScript (could be a lot of work). Alternatively, maybe the core of Mycelium can be compiled to WASM (e.g. routing logic, cryptography, no network conn, no NAT etc.). I don’t have experience with Rust, and I don’t know how feasible this is.

  • Running in the browser would also require Mycelium to support WebRTC or WebSocket connections besides TCP/IP and QUIC, so that web frontends or browser extensions would be able to participate in the network.

  • WebRTC connections would even allow browsers to fully participate in the mesh with peer-to-peer connectivity, e.g. serverX <-> browserA <-> browserB <-> serverY.

  • If there are plans to eventually run Mycelium in the browser, the projects using it would need to consider whether they would support running in the browser. E.g. more projects could be written in TypeScript, and could use something like Yjs (powerful CRDT lib in JavaScript) to manage and sync state between peers.

These are just some draft ideas (from a perspective of a builder who would like to build on top of Mycelium). I understand such features would be post-MVP, or could not be in the planned scope of the project. Just wanted to get the discussion going and to explore different use cases with the community.

1 Like