risk_propagation.player module

Configuration of a bank

class risk_propagation.player.Player(name, accounts, transactions, pool, paillier, delta=0.5)[source]

Bases: object

Player class performing steps in protocol

COMPENSATION_FACTOR = 1000000000000
__init__(name, accounts, transactions, pool, paillier, delta=0.5)[source]

Initializes a player instance

Parameters:
  • name (str) – the name of the player

  • accounts (DataFrame) – a dataframe of accounts containing an initial risk score per account

  • transactions (DataFrame) – a dataframe of transactions

  • pool (Pool) – the communication pool to use

  • paillier (DistributedPaillier) – an instance of DistributedPaillier

  • delta (float) – the delta to use

property banks: Tuple[Bank, ...]

All banks in the protocol

Returns:

all banks in the protocol

async decrypt()[source]

Decryption of the risk scores per bank, compensating for the COMPENSATION_FACTOR

Return type:

None

encrypt_initial_risk_scores()[source]

Encrypt the initialised risk scores of this player’s accounts

Return type:

None

async iteration()[source]

Perform a single iteration

Return type:

None

property other_banks: Tuple[Bank, ...]

The other banks in the protocol

Returns:

the other banks in the protocol

property risk_scores: Dict[str, FixedPoint]

The plaintext risk scores belonging to this player’s bank

Returns:

plaintext dictionary of risk scores

Raises:

AttributeError – raised when risk scores are not available

async run_protocol(iterations)[source]

Runs the entire protocol

Parameters:

iterations (int) – the number of iterations to perform

Return type:

None

update_risk_scores()[source]

Updates risk scores of all accounts

Return type:

None