6.4. Threshold Coin¶
-
class
aleph.crypto.threshold_coin.
ThresholdCoin
(dealer_id, process_id, n_processes, threshold, secret_key, verification_key)¶ Implements dual threshold coin described in the whitepaper.
- Parameters
dealer_id (int) – identification number of a process dealing this coin, from 0 to n-1
process_id (int) – identification number of a process using this coin
n_processes (int) – number of processes
threshold (int) – number of shares required to toss the coin, has to satisfy n_processes//3 < threshold <= n_processes
verification_key (VerifyKey) – key for combining shares
secret_key (SigningKey) – key for generating a share of a coin toss
-
check_validity
()¶ Checks if this threshold coin is valid.
Combines the coin shares by forming a threshold signature and taking its 1st bit, subsequently it verifies the result. NOTE: combining shares should always succeed except when some of the shares were invalid or the dealer was dishonest, in which case the toss might be biased and should ideally be discarded
- Parameters
shares (dict) – keys are processes ids, values are shares (group G1 elements)
nonce (string) – the nonce the shares were created for – necessary for verifying the result of combining
- Returns
pair (int, bool) : (coin toss in {0,1}) , (whether combining shares was succesful)
- Parameters
nonce (int) – nonce for the coin share
- Returns
coin share for the nonce
- Parameters
coin_share (CoinShare) – coin_share which validity is checked
process_id (int) – identification number of a process that generated the coin_share
nonce (int) – nonce for which the coin_share was generated
- Returns
True if coin_share is valid and False otherwise