DAG IMPLEMENTATION

Let’s take a look at how the project uses the DAG algorithm as a consensus project. The project mainly implements the mapping of the same RoundReceived transaction to a block after forming a consensus in dag to form a linear area. Blockchain data structure, using ethereum’s ledger structure.

The above class diagram mainly reflects the core class modules of DAG, modules such as crypto and network communication are not included.

Event is the basic data structure of DAG. As mentioned earlier, Store is responsible for the storage and management of data. The DAG class is the core of the DAG consensus algorithm. The main method is to implement the visible and strongly visible judgments. To get the known Event and vote.

The core logic of Core’s entire node includes inserting events, merging events, and running consensus.

The node module is responsible for the gossip between nodes, processes the received gossip requests and returns, and is responsible for the ethereum’s proxy communication with the nodes.

Combining the above, we look at the specific business process, from the initiation of the transaction to the entire logic of the transaction into a block.

1) We start an ethereum node and a DAG node, and they are connected through proxy.

2) Ethereum calls proxy to pass the transaction to the DAG node. The DAG node calls core’s AddTransctions to add the received transaction to the transactionpool.

3) The gossip heartbeat detects that a gossip needs to be initiated, it will create a new event package all the transactions in the transactionpool into the event, and then insert it into the store.

4) Randomly select a peer, initiate gossip, pull events from the target peer that they do not know about the other party, and pass the events that they know to the other party.

5) Get the event returned by the other party, call Core’s EventDiff to merge the events, and add events in the pedding area, then run RunConsensus to DivideRounds, call DecideFame to determine famous witnesses.

6) Through multiple gossip, famous witnesses are determined, and then FindOrder is called to decide roundReceived and consensus Timestamp, then sort.

7) Call handle NewConsensusEvents to take out the new consensus event, and package the transactions into a block, and empty the pedding area.

8) Return the block to ethereum, ethereum executes the transactions in the block, and returns the ledger status to the DAG. The DAG puts the ledger status into a block, signs it, and broadcasts the signature to other DAG nodes. Other DAG nodes receive the signature, verify that it is correct, merge with your signature into the block, and broadcast your signature.

Hashgraph is pioneered asynchronous BFT consensus in the public chain environment. A major problem with tradional BFT is that the message complexity is too high, it consumes the network bandwidth of the system, and it cannot deal with dynamic networks well. Here Hashgraph introduce the traditional Gossip Protocol, and adds unique innovations, plus a virtual voting mechanism, so that when consensus is needed, it will not cause a sudden large-scale messaging storm.

Hashgraph and Algorand improved the BFT application scenarios and conditions from different angles to enable BFT consensus to be applied to the public chain system. HG spread the hash map through gossip and virtual voting based on the hash map. Communication requirements are minimized, and local calculations ensure consensus efficiency.

The latest Hashgraph “public chain” business introduction book states that it is planned to switch to POS, and support DOPS, and allows holders who do no run full nodes to choose agents and share revenue.

Hashgraph gathers the strengths of various companies, and has made grate breakthroughs in scalability, security, and consensus-building costs, but the technology is difficult and has not been run in a large-scale public chain environment. As described in the white paper, then Hashgraph is enough to become an important milestone for exploration on the trusted internet. It may break through the limitations of the blockchain and achieve a strong attempt to achieve the ultimate ideal of the blockchain from an innovative path.

--

Creating a new generation of blockchain infrastructure.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store