Before you are able to deploy jobs on DCP, you need two types of API keys (called ‘keystores’).
An Identity Keystore: This keystore acts as your personal credentials for using DCP. Identity Keystores are also called Identity Keys, ID Keys, etc.
An Account Keystore: This keystore keeps track of the amount of value (called ‘credits’) that you have available.
You can download both keystores from the Portal, which is also where you can see the amount of value left in your one or more Account Keystores.
From the First Devs tab in the Portal, one can provision, download, and revoke all Identity Keystores, once you have made an account.
You can provision new Identity Keystores by clicking the green “+” in the top-right of the table on this page. This prompts you to enter a label (required) and then the generated key appears in the table.
Downloading Identity Keystores
You can download an Identity Keystore by clicking on the green download button. This prompts you to enter an optional passphrase to encrypt the keystore with.
Hit ‘Continue’ without entering anything in the passphrase field to leave them unencrypted.
You are then prompted to save the keystore file with the default name
It’s recommended to save your
id.keystore file in your home directory at
/home/<YOUR_USER_NAME>/.dcp/id.keystore (Linux & macOS), or
C:\Users\<YOUR_USER_NAME>\.dcp\id.keystore (Windows). This is the default location where DCP’s APIs look to find your identity keystore, which it needs to deploy a job.
It’s recommended to not change the name of the
id.keystore when you save it.
You can revoke Identity Keystores by clicking the red “-” to the right of the download button. This revokes the key’s association to your account, so any keystore files that you have downloaded stop working.
Your Account Keystores are visible in the Accounts page on the portal. Your portal account comes with a ‘default’ Account Keystore, which has a balance of 0 credits.
You can use any Account Keystore to earn credits using the Portal’s in-built Worker tab. All you have to do is go to the Worker tab and click the green “Start” button. The worker starts using your computer’s processing power to complete computational jobs in exchange for credits that you can use to deploy your own work. You can stop this at any time by clicking “Stop” or exiting the browser tab. You can earn credits in more ways at no cost.
Downloading Account Keystores
You can download your Account Keystores from the Accounts page by clicking the arrow at the bottom of the keystore card, and then clicking “Download.” It’s recommended to save this keystore file in your home directory at
/home/<YOUR_USER_NAME>/.dcp/default.keystore (Linux & macOS), or
C:\Users\<YOUR_USER_NAME>\.dcp\default.keystore (Windows). This is the default location where DCP’s APIs look to find your Account Keystore, which it needs to deploy a job.
It’s recommended to not change the name of the
default.keystore file when you save it.
Using Keystores in web apps
Providing the Account Keystore for deploying jobs from your browser is straightforward - the
dcp-client APIs automatically prompt you with a modal to upload your Account Keystore when you start deploying the job.
The following is a temporary solution. It exposes your (revocable) Identity Keystore to the public. A planned long-term solution to this issue is to make DCP compatible with the OAuth protocol.
To provide your Identity Keystore to launch a job (which DCP requires alongside your Account Keystore), you must include your Identity Keystore in the web directory where your HTML file is. The
dcp-client APIs looks for it when deploying your job, and warns you in the console if it couldn’t locate it.
Here is an example of a directory structure if how might lay out your app:
public |-- index.html `-- id.keystore
Most of the ‘vanilla web’ HTML examples in this documentation have already indicated this Identity Keystore. Hence, when an example asks you to upload your ‘keystore’ to launch a job, it’s asking for your Account Keystore. This isn’t the case for vanilla web jobs that you build yourself, which should follow the directory structure provided earlier.
Using Keystores in Node.js apps
dcp-client APIs to build Node.js apps is even easier - the library looks for your keystores in the default location,
.dcp in your home folder. This is what your
.dcp folder should look like:
.dcp |-- default.keystore `-- id.keystore
If the library can’t find the keystores, it throws an error containing information about where they were searching for the files. You have to move them into the appropriate file locations described earlier to launch a job without error.