Decentralize Network with Rust

I finished basic programming with Rust, and the goal is to build a new decentralize network. But I don't know what to learn with Rust. Can anyone give me some advice for what should I learn more. Thank You everyone.

3 Likes

Welcome!

I highly recommend that you learn asynchronous programming. Read-on about Tokio, as an example. We are in the midst of a big transition in the ecosystem, but async/await syntax is almost stable now, and there are many libraries you can use in the interim. What kind of network are you trying to build?

I want to build decentralize network, it’s like IOTA.

Bro, that's a HUGE project. You want to build a blockchain im guessing?

1 Like

Yes I knew but can you give me some clue where to start.

I'm not familiar with "IOTA", but the decentralised network space is huge in Rust.

So huge in fact, that for you as newcomer, I'd recommend you start out by contributing to existing projects first, to get a feel for how big projects work in Rust.

You'll probably want to look at the company "Maidsafe", who are also building a decentralised network.


"Parity" is also a company to pay attention to:

And while I personally am sceptical of the (lack of) privacy of anything that comes out of Facebook, we should give credit to their tech prowess: their Libra cryptocurrency is also written in Rust.

These are just a few of them, there is a LOT happening, because frankly, Rust is a very good fit for the requirements (as you have no doubt discovered yourself!)

3 Likes

Thank you very much but can you give me that what should I learn from in order to do that especially with network, what sort of network should I learn?

1 Like

Since your question is incredibly general, I cannot give you specifics. Since you demonstrate no background knowledge, I recommend you first read what others are doing, and learn from that, to get a feeling for the field.
Without this background, you will have a hard time succeeding (your plan is extremely ambitious, many regulars here on this forum would fail too)

Both companies I mentioned publish open source crates and good blog posts, which explain their design and the factors you must pay attention to.

I am not going to write a tutorial for you, smarter people than me have already done that, and with my hints you should be able to find them :wink::angel:

Learning async programming in rust will definitely come in handy. However the tokio documentation is old and outdated. I would try to pick up the new syntax immediately and use the compat layer from the futures 0.3 library if some crate gives you a futures 0.1 type.

I think the best place to start, even though it's still in production, is the async book. To understand some more details, the blog posts from withoutboats might be a good start: https://boats.gitlab.io/blog/

I'm afraid that there is no definite documentation yet. You can also search through "this week in rust", and look for blog posts about async-await.

2 Likes

Thank you very much anyway Can I know what you have done before related to network?

Thank you very much, if you have more to add please add here, I’m happy to get it.

I write "standard" web platforms, and bioinformatics software that runs on our HPC cluster; unfortunately not in Rust :frowning:

I do read a lot about these systems, because I find them fascinating, and wish to learn from them :slight_smile:
E.g. read about "raft" protocol, it is a very elegant solution to distributed master election. tiKV (distributed key-value DB in Rust) has an intro:

TreeScale does cool things too in scaling across thousands of nodes:

One thing that I have learned over the years is that distributed systems are highly complex, because you get exponentially scaling interactions.
Add to that that the individual components are usually unreliable (network hiccups, disk errors, Auth caches being annoying; we see it all in our 3000 core work cluster; and that's a homogeneous system completely under our control..), which means you have to be a genius in error handling (fortunately, rust helps here!)

The second thing I've learned is that I am not good enough to write crypto code. Almost no-one is. (There are maybe 200 people in the world who are, I'm not one...)

Cryptocurrencies are both distributed, and crypto, so I'm personally not going there. You are a braver person than I am!

1 Like

Over the weekend, I recalled another example of why I personally am never writing cryptocurrency code:
The Ethereum DAO "incident"

In C, if you're careless, you get defaultssegfaults and hard to debug data races.
In Rust, if you're careless, you get panics.
In cryptocurrencies, if you're careless, hackers steal 70 million dollars and you must rebuild your community from scratch.

And to be fair: I wouldn't even say that the DAO authors were careless. Everything about Ethereum and the DAO is quite well thought out, and still they overlooked one tiny implementation detail: the update order of their variables (a+x; b-x instead of b-x; a+x).
That's trivial and unimportant in any normal system, but in a distributed, parallel one? BAM! 70 million dollars gone...

I personally do not want that kind of responsibility, but if you do, I believe that Rust is one of the best possible ways to get there :slight_smile:

Thank you very much.

Curious about what you used for learning Rust

I want to know that what lesson should I learn to do as I mention on subject above.