Skip to content

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.

pip install cosmian_secure_computation_client

Create a python file and import cosmian_secure_computation_client.


from cosmian_secure_computation_client import ComputationOwnerAPI, CodeProviderAPI, DataProviderAPI, ResultConsumerAPI


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(
    data_providers_emails=["", ""],
    result_consumers_emails=["", ""]

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.

words = ComputationOwnerAPI.random_words()

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.


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(
    data_providers_emails=["", ""],
    result_consumers_emails=["", ""],
    # activate development mode

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

© Copyright 2018-2022 Cosmian. All rights reserved