This is an imlementation of the basic UC framework. It provides code to specify functionalities, protocols, and adversaries, and provides an execution environment to run real and ideal word executions.
Installation is easy (we assume python>=3.5)
- Clone the repo and go into the
uc_contracts/directory. - Install the dependencies with
pip install -r uc/requirements.txt - Install the the
ucmodule as a working module withpip install -e .
If you're able to run python uc/apps/coinflip/env.py successfully and get output you're good to go!
uc/: Python UC module that implements the basic frameworkitm.py: implements the ITMprotocol.py: the base class for all protocols and theProtocolWrapperand theDummyPartyfunctionality.py: the base class for all functionalitiesadversary.py: the base for all adversaries and theDummyAdversaryexecuc.py: executes a UC experiment given an environment, functionality, protocol, and adversarycompose.py: a composition operator for protocols and simulatorsutils.py: some handy functions
We use a construct called the ProtocolWrapper in protocol.py. This wrapper encapsulates the "protocol" and internaly creates instances of the protocol as protocol parties. It also routes messages to/from the protocol parties based on the intended pid recipient of the messages that it receives.
Protocols in UC are usually not in any kind of wrapper and therefore, from their point of view, are communicating over a channel directly to the functionality or the environment. Therefore, the ProtocolWrapper ensures this is the view of the parties.
A consequence of the wrapper is that the functionality, adversary, and environment need to know the pid of the messages received by the wrapper.
The parties themselves don't add their pid to messages because they "think" they are directly communicating to other with a dedicated channel. Therefore, the wrapper appends the pid of the sending parties to all outgoing messages by them.
See the docstring for the ProtocolWrapper for a more in depth explanation.