This page contains source code for experimental results in the following paper:
[1] Yucheng Sun, Haifeng Yu. 2026. Heavy-coin Committee Selection for the Decentralized Era.The source code is available here. In the next, we provide step-by-step guide for re-generating all our experimental results, namely, Figure 1-9 of [1].
One need to compile our source code before running it, by executing:
javac *.java
This should succeed without any error message.
These results require obtaining the error probability of committee selection schemes (Canonical scheme, FA scheme, TPL scheme, and heavy-coin scheme), under given committee size. Next, we first show how to obtain the error probability of these schemes; then based on this, we show how to obtain the results in Figure 1,2,5,7,9 of [1].
How to obtain error probability of the 4 schemes. One should execute the following general command:
java [scheme] [is_fixed_size] [committee_size] [t] [epsilon] [distribution] [gini]
The program will output the error probability of the specified scheme, under given committee size (and other given settings). We now explain in details what these parameters are:
[scheme] is the name of the scheme. Use Canonical, FA, TPL, or HC. These mean Canonical scheme, FA scheme, TPL scheme, and heavy-coin scheme, respectively.[is_fixed_size] indicates whether the scheme is of fixed-size version or variable-size version (see [1] for definition). Use true for fixed-size version and use false for variable-size version.[committee_size] is the given committee size.[t] and [epsilon] corresponds to the parameter \(t\) and \(\epsilon\), as defined in [1].[distribution] is the name of the stake distribution. Use eth, bit, btc, or doge. These mean Ethereum, Bitcoin, BitcoinCash, and Dogecoin, respectively.[gini] means Gini coefficient, and is an optional parameter that one can specify to obtain more decentralized stake distribution. For example, if one use eth in [distribution] and 0.5 in [gini] , then one can generate results for the setting "Ethereum distribution with Gini 0.5" in [1].To generate results for Figure 1, one should execute:
java [scheme] false [committee_size] 1/3 0.1 eth [gini]
, where [scheme] can be Canonical, FA, or TPL. For example, to generate one data point in Figure 1(c) of [1], say the error probability of Canonical scheme with committee size is \(2000\), under Ethereum distribution with Gini coefficient \(0.5\), one can execute:
java Canonical false 2000 1/3 0.1 eth 0.5
The program will output the following:
"canonical":[(2000,3.68e-24), ],
This means the error of Canonical scheme in this setting is \(3.68\cdot 10^{-24}\). One can similarly generate all results in Figure 1 by using different parameters.
To generate results for Figure 2, one should execute:
java [scheme] false 3492 1/3 0.1 [distribution] [gini]
, where [scheme] can be FA or TPL. For example, to generate one data point in Figure 2(b) of [1], say the value of \(S_1\) in FA scheme, under Bitcoin stake distribution with Gini coefficient \(0.5\), one can execute:
java FA false 3492 1/3 0.1 bit 0.5
The program will output the following:
double[] faS1s=new double[]{0.5324445888068552,};
This means the value of \(S_1\) here is about \(0.53\). One can then similarly generate all results in Figure 2.
One can generate the results in the same way as in Figure 1. The only exception is that now [scheme] can be all of Canonical, FA, TPL, or HC.
Same as Figure 5, except that one needs to use true for the [is_fixed_size] parameter when calculating the error of committee selection schemes.
Same as Figure 1, except that one need not provide the [gini] parameter.
Generating results in Figure 3 is trivial: one only needs to calculate the probability density function of two Binomial distributions (\(\textbf{Bin}(2000,0.05)\) and \(\textbf{Bin}(200,0.5)\)). One can easily calculate this himself/herself.
One can generate the results in Figure 4 by running:
java Denominations
The program will output:
gini=0.6, t=0.33
[(r=1,var[Z]=566.7), (r=2,var[Z]=406.4), ...... (results for other r's)
lower bound=338.9
...... (results for other settings)
This means, for example, when the Gini coefficient is \(0.6\), \(t=1/3\), then \(\text{Var}[Z]=566.7\) when \(r=1\), and \(\text{Var}[Z]=406.4\) when \(r=2\); the lower bound of \(\text{Var}[Z]\) (see [1]) is \(338.9\).
These results require obtaining the needed committee size of committee selection schemes (Canonical scheme, FA scheme, TPL scheme, and heavy-coin scheme), to achieve certain target error. We first show how to obtain the needed committee size; we then show how to obtain the results in Figure 6 and 8 of [1].
How to obtain committee size of the 4 schemes. One should execute the following general command:
java FindSize [target_error] [scheme] [is_fixed_size] [t] [epsilon] [distribution] [gini]
The program will output the required committee size of the specified scheme, to achieve the given target error probability, under the specified settings. Here, [target_error] is the target error probability of the scheme. The remaining parameters follow the definition in section 2 above.
For example, one can run:
java FindSize 1e-40 Canonical false 1/3 0.1 eth 0.5
, to find the needed committee size of Canonical scheme (variable-size version) to achieve \(10^{-40}\) error probability, under \(t=1/3\), \(\epsilon=0.1\), Ethereum stake distribution with Gini coefficient \(0.5\).
The program will output:
[FindSize] Canonical min committee size for error 1.00e-40: 3492
, which means the needed committee size in this setting is \(3492\).
To generate results for Figure 6, one should execute:
java FindSize 1e-40 [scheme] false [t] 0.1 [distribution] [gini]
, where [scheme] is Canonical, FA, TPL , or HC. The program outputs the required committee size to achieve \(10^{-40}\) error probability for the committee selection schemes. Then, one can easily calculate the reduction achieved by FA/TPL/HC scheme, compared to the canonical scheme.
For example, to generate the data point in Figure 6(a) with Gini coefficient \(0.5\) for HC scheme, one can execute:
java FindSize 1e-40 HC false 1/3 0.1 eth 0.5
, and the program will output:
[FindSize] FA min committee size for error 1.00e-40: 2628
, which means the HC scheme in this case need committee size \(2628\). In the previous example, we know in this setting, Canonical scheme needs committee size \(3492\). Then, the reduction in committee size is \((3492-2628)/3492\approx 25\%\).
One can generate the results for Figure 8 in the same as in Figure 6, except now the [is_fixed_version] parameter should be true.