Quantum Rings credentials

To run circuits with the Quantum Rings SDK you will need:

  • Your Quantum Rings token (API key)

  • Your Quantum Rings account name

You can store credentials locally so you do not need to pass them every time.

Manually create the local configuration file

You can also create the configuration file directly and store your credentials.

Linux / macOS (config file)

mkdir -p ~/.config/quantumrings
echo -e '[default]\nemail = <YOUR_ACCOUNT_ID>\nkey = <YOUR_ACCESS_KEY>\nbackend = scarlet_quantum_rings' > ~/.config/quantumrings/quantumrings.conf

Windows (config file)

Create a folder named quantumrings under %APPDATA%. In that folder, create a file named quantumrings.conf with the following contents:

[default]
email = <YOUR_ACCOUNT_ID>
key = <YOUR_ACCESS_KEY>
backend = scarlet_quantum_rings

Using the toolkit for Qiskit

If you are using the Quantum Rings toolkit for Qiskit, you can save credentials using QrRuntimeService.save_account().

from quantumrings.toolkit.qiskit import QrRuntimeService

service = QrRuntimeService(token=<YOUR_TOKEN_HERE>, name=<YOUR_ACCOUNT_NAME_HERE>)
service.save_account(token=<YOUR_TOKEN_HERE>, name=<YOUR_ACCOUNT_NAME_HERE>, backend="scarlet_quantum_rings")

Alternative: use environment variables

As an alternative, store the account name and token as OS environment variables.

Windows (Command Prompt)

setx QR_TOKEN "<YOUR_TOKEN_HERE>"
setx QR_ACCOUNT "<YOUR_ACCOUNT_NAME_HERE>"

Linux / macOS (environment variables)

Add the following lines to your shell configuration (for example ~/.bashrc):

export QR_TOKEN="<YOUR_TOKEN_HERE>"
export QR_ACCOUNT="<YOUR_ACCOUNT_NAME_HERE>"

Then read the values from Python:

import os

my_token = os.environ["QR_TOKEN"]
my_name = os.environ["QR_ACCOUNT"]

Verify your credentials

A quick check is to create a provider or runtime service and confirm the account metadata can be read (for example, account name and max qubits).