This page contains the source code for the experimental results presented in the following paper:
[1] Yucheng Sun, Ruomu Hou, and Haifeng Yu, Robust and low-degree overlay for secure flooding against resource-bounded adversaries,” School of Computing, National University of Singapore, Tech. Rep. TRA9/24, 2024, also available at https://dl.comp.nus.edu.sg/handle/1900.100/12.The source code is available here. The remainder of this page provides step-by-step instructions on how to reproduce all our experimental results.
All input data files are stored in the subdirectory ./data/. In the subdirectory, files named XXX_10k.txt are the stake distributions for n=10000 of the six cryptocurrencies, and files named XXX_histo_100k.txt are the stake distributions for n=100000 of the six cryptocurrencies.
The source code to regenerate results in Figure 1 and 2 in [1] is in the subdirectory ./figure1-2/.
For Figure 1, one can obtain the maximum node degree in Liu's and Coretti's design for different stake distributions by running:
chmod 700 *.sh
./liu.sh
./coretti.sh
For Figure 2, one can obtain v_max in Liu's and Coretti's design for different stake distributions by running:
python3 v_max.py
The source code for the results presented in Figure 4-6 in [1] is in the subdirectory ./figure4-6/.
We implemented the algorithm for constructing our LoR topology in tga.cpp, whose input is a stake distribution, and topology parameters. The program constructs our LoR topology and also outputs metrics such as maximum out/in degree and the diameter. These maximum out/in degree and diameter results are presented in Figure 4-6. One can run it by:
g++ -o a.out tga.cpp -std=c++11
./a.out distribution_data_path n f g k l
For example, one can run the command:
./a.out ../data/bitcoin_10k.txt 10000 0.2 8 49 19
to obtain the LoR topology (along with its max out-degree, max in-degree, and diameter) for the bitcoin distribution with n=10000 nodes under f=0.2, with parameter g = 8, k = 49, l = 19.
The parameters used in our LoR topology, as presented in Figure 7 in [1], should pass Algorithm 1 in Appendix B in [1]. We implemented Algorithm 1 in the subdirectory ./algorithm1/. The program is named pta.cpp. (We note that pta.cpp actually provides more functionalities than Algorithm1.)
To run Algorithm1, one can do:
g++ -o a.out pta.cpp -std=c++11
./a.out n f epsilon delta g k l
to get the output of Algorithm1(n, f, epsilon, delta, g, k, l). One can use this to verify the parameters in Figure 7. For example, one can run:
./a.out 10000 0.2 0.1 0.01 8 93 31
and Algorithm1 will output the following after it finishes:
Algorithm1 passes with n=10000, f=0.2, epsilon=0.1, delta=0.01, g=8, k=93, l=31