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
Some browser’s extension may interfere with the token page
Some browser’s extension, like Privacy Badger, may interfere with the token page. These extension should be deactivate for the
console.cosmian.com domain for the token generation to work properly.
Also, if you use Google Chrome, you should allow third-party cookies for now. We are working toward a fix to this issue.
Install the libraries¶
Create a python file and import
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="firstname.lastname@example.org", data_providers_emails=["email@example.com", "firstname.lastname@example.org"], result_consumers_emails=["email@example.com", "firstname.lastname@example.org"] ) 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.
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.txtfile at the root of your code
- create the computation in development mode:
computation = computation_owner.create_computation( computation_name, code_provider_email="email@example.com", data_providers_emails=["firstname.lastname@example.org", "email@example.com"], result_consumers_emails=["firstname.lastname@example.org", "email@example.com"], # activate development mode dev_mode=True )
This way, the required dependencies will be installed automatically when code runs.
Beware the development mode is insecure and is just for testing. This should not be used in production