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
uc
module as a working module withpip install -e .
We include a simple Dockerfile based on python3.6, you can see there are not many dependencies
docker build -t saucy .
docker run -v $PWD:/uc-contracts -it saucy
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 theProtocolWrapper
and theDummyParty
functionality.py
: the base class for all functionalitiesadversary.py
: the base for all adversaries and theDummyAdversary
execuc.py
: executes a UC experiment given an environment, functionality, protocol, and adversarycompose.py
: a composition operator for protocols and simulatorsutils.py
: some handy functions
uc/apps/
: Examples of using the Python UC modulecommitment/
: an example of a bit commitment in the random oracle modelcoinflip/
: a coin flip that uses bit commitmentsimplecomp/
: composition example, deplaces F_com with commitment protocol
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.