PBFT-Golang implementation details

PBFT-Golang implementation details

The Prime Minister needs to know that the implementation of the PBFT algorithm is not as simple as it sounds. The most important thing we usually hear about the implementation of this algorithm is just a protocol in this algorithm-----Consistency Protocol .
There are also checkpoint protocols and view replacement protocols. If you are interested, you can look for materials. You can also leave a message.

1. Limitations

But as mentioned earlier, what most people care more about is the first stage, that is, the first protocol: the consistency protocol. This is not surprising, after all, this is a point that everyone generally thinks is important. But instead, it would be the other two stages that would be improved upon.

2. I won’t say much about the entire background knowledge. Find it yourself. Let’s get to the point.

2.1 How to implement such a PBFT through Golang language?

Consistency Agreement:
Insert image description here
Still a familiar recipe and a familiar taste.
Similarly, I emphasize that this article is not suitable for novices, after all, it involves golang-related grammar. Of course if you do, just ignore it.

1. Why choose golang for implementation?
  1. The first person has hobbies, likes this language, and is relatively familiar with it.
  2. Second, it is really easy to use, after all, it can implement coroutines.
  3. Third, of course, considering that to implement this program, we need client on the one hand and node on the other hand, it is more reasonable for the coroutines to send messages to each other.
  4. net/http is easier to use and can replace the P2P protocol.
2. Implementation program diagram

Insert image description here

Code implementation and analysis (waiting...organizing)

Among the many codes, I think the code that can be implemented better is written by this old man:
https://github.com/corgi-kx/blockchain_consensus_algorithm /tree/master/pbft
It is still very good for data requests and client request processing operations. This article is mainly based on the interpretation of this code. If you are interested, you can directly look at the source code of this elder brother, which is very exciting.

Guess you like

Origin blog.csdn.net/YSS_33521/article/details/111460767
Recommended