BlockDAG blue set selection algorithm is the base of the blockDAG technology. The ‘blue set’ means a k-cluster SubDAG, let’s use S denotes it, such that |anticone(B)| ∩ S <= k, for all B ∈ S. We term this selection of a k-cluster a coloring of the DAG, and use the colors ‘blue’ and ‘red’ as a convention for blocks inside and outside the chosen cluster, respectively.
A special subtype of BlockDAG is the ‘0-cluster’ SubDAG, that is, BlockChain! Such as Bitcoin, Etherum, and so on. ‘k=0’ is the exact root cause of BlockChains have the highly restrictive throughput, for example ‘Bitcoin’ throughput is 3-7 transactions per second (tps). BlockDAG is the BlockChain’s future!
How to build a test?
For example, to run the simulation for the example Fig.3:
1 | $ cargo test test_fig3 -- --nocapture |
To run the algorithm simulation for an example of generating 1,000,000 random blocks, and execute the blue selection in a real-time calculation:1
$ cargo test test_add_block -- --nocapture
To add your own BlockDAG example to see the blue selection behavior, it’s quite simple! For example, to test a DAG in this figure ‘Fig.4’, just add a piece of codes like this:
1 |
|
then run it by cargo test test_your_example -- --nocapture
The output will be someghing like this:
1 | running 1 test |
The source code open for this blue selection algorithm details.
The full source code is here: rust-dag.