Tolar Code Review HashNET Blockchain
Share this article
HashNET is the blockchain, Tolar is the cryptocurrency, and although the Tolar code review here is actually very interesting I feel that maybe my introduction isn’t, because it has all the same content that we’re starting to get used to seeing – scalable, fast, secure etc. etc.
This is not a bad thing, it means the blockchain community is rallying around the concepts that are actually going to lead to widespread adoption, and all competition is good competition right now.
So here’s their basic pitch, from the website:
“Tolar is an open source, community governed crypto-currency featuring scalable, fast, secure, and fair transactions.”
“HashNET is a scalable, fast, secure, and fair decentralized- beyond blockchain project, leveraging Distributed Ledger Technology (DLT) and consensus algorithm which keeps all positive characteristics of a blockchain technology while increasing throughput to more than 200,000 transactions per second. Network is using Proof-of-Stake with masternodes, which eliminates the need for a massive energy consumption.”
Usual buzzwords. 200k TPS. Proof-of-Stake with masternodes.
Jumping into the whitepaper doesn’t help much. We have a new gossip protocol, what’s wrong with the current ones? We have nodes assigned a weight and a reputation system. Competition is good, but novelty is very good.
Not really seeing what is new here or how they are backing up their claims.
We are given a sneak peak at the code, so let’s jump into it.
We have two sections, we have some c++ code and we have some Go code. The C++ code is doing the hasnet work, the Go code is doing the networking and node setup.
Jumping into the Go code first.
Their new push/pull model, a node randomly selects another and then sends them what the current node has, if there are discrepancies they get a payload back. Straight forward.
Nothing wow, but nothing bad, just the peer networking.
Here things get interesting, HyperMajority calculates how many nodes have a clear path to a specific event. Let’s quickly discuss normal consensus. We receive and process transactions, if we are happy with the transactions received and processed we pack them into a block, we send the block off for consensus (PoW we simply mine the block, PoS we have it voted on to see if majority agrees, dPoS we have one of the delegates decide).
So then, how can a majority vote be reached on an event? When the event is received, we already know its stake?
In normal blockchain design, we ask for consensus after we process. In this design consensus happens as we process. So how is this achieved?
(This is actually why they built their new Gossip protocol), part of the gossip protocol is Node stake. That’s why the whitepaper stresses that each Node needs full system awareness. As they receive transactions they are almost finalized via the p2p propagation and not really consensus. When enough Nodes (with enough Stake) have accepted the transactions into their pool, they all agree they like that transaction and they can move on.
Tolar Code Review Conclusion:
Great fundamental design, one that I look forward to see in the testnet, as soon as it is out. I think it can make a real difference in both finality and transaction throughput. It does lock them into Proof-of-Stake, since redesigning consensus will be a ground up design, but I don’t think that is inherently bad.
All in all, good code, novel design, excited to see where this goes.
Disclaimer: Crypto Briefing code reviews are performed by auditing what is on display in the master branch of the repo’s made available. This was performed as an educational review and any comments in the article are the opinion of the writer. It is normal for code to change rapidly, hence we timestamp our code reviews so that they present a snapshot at a moment in time. Information contained herein should not be used as any comment or advice on the project as a whole.
Tolar Code Review Timestamp: June 8th, 2018 at 09:20 GMT
Share this article