Create a computation
Welcome to Secure Computation
To launch your first computation, you can follow this tutorial or clone our Jupyter notebook example.
If you don’t know which path to follow, the easier one is the Jupyter notebook.
Create a new computation as a Computation Owner by providing a computation name, the list of participants and your secret token.
Get your secret token¶
Go to Cosmian Console Secret token page and copy your secret token. Store your token inside an env
variable.
Install the libraries¶
Install cosmian_secure_computation_client library.
Create a python file and import cosmian_secure_computation_client
.
Initialize the computation¶
Specify the computation name and the email addresses of the different participants: only one code provider but several data providers and several result consumers are accepted. You will be the Computation Owner of this computation.
computation_name = "My first computation"
# copy/paste your secret token from Cosmian's console
cosmian_token = "xxxxxxxxxxxxxxxxxxxxxx"
computation_owner = ComputationOwnerAPI(cosmian_token)
computation = computation_owner.create_computation(
computation_name,
code_provider_email="code.provider@email.com",
data_providers_emails=["data.provider.1@email.com", "data.provider2@email.com"],
result_consumers_emails=["result.consumer1@email.com", "result.consumer2@email.com"]
)
print(computation)
Then generate three random words. These are your shared secret with all participants. Cosmian will never ask for it. Send them to your participants by mail, phone or any other mean.
Congratulations! Your first computation is created and ready to receive encrypted code and encrypted data. Visit My Computations page to see the list of your computations. Other participants will also see this computation on their page.
Archiving
Cosmian automatically archives computations after seven (7) days. You cannot interact or download the result of an archived computation, but you can still fetch the computation’s checklist.
Install other Python dependencies¶
If your code needs other Python dependencies that are available in Pypi but not provided by Cosmian, you can install them by following these two simple steps:
- provide standard Python
requirements.txt
file at the root of your code - create the computation in development mode:
computation = computation_owner.create_computation(
computation_name,
code_provider_email="code.provider@email.com",
data_providers_emails=["data.provider.1@email.com", "data.provider2@email.com"],
result_consumers_emails=["result.consumer1@email.com", "result.consumer2@email.com"],
# activate development mode
dev_mode=True
)
This way, the required dependencies will be installed automatically when code runs.
Dev Mode
Beware the development mode is insecure and is just for testing. This should not be used in production