cicada.calculator module
Implements a client and a server for an MPC-as-a-service calculator.
- class cicada.calculator.Client(addresses)[source]
Bases:
object
Client for working with the privacy-preserving RPN calculator service.
- Parameters:
addresses (sequence of
str
, required) – Socket addresses of the players providing an RPN calculator service.
- exception cicada.calculator.PlayerError(exception, traceback)[source]
Bases:
Exception
Returned from the RPN calculator service when a player raises an exception.
- cicada.calculator.main(listen_socket, communicator)[source]
Implements a privacy-preserving RPN calculator service.
This is an example of MPC-as-a-service, for cases where that is desirable. Run this function using:
SocketCommunicator.run_forever(world_size=n, fn=cicada.calculator.main)
… which will start the service and return a set of player addresses and processes. Client code can use those addressess to connect to the service and issue commands, which will be executed by the service players.
The service implements an RPN calculator where communicators, protocols, and operands are pushed and popped from stacks.