> For the complete documentation index, see [llms.txt](https://sp8de-docs.gitbook.io/s-p-8-d-e-or-white-paper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sp8de-docs.gitbook.io/s-p-8-d-e-or-white-paper/technical-quantrapy-manual/random-purchase.md).

# Random purchase

Please install quantrapy with steps below before purchase if you have not installed the [generator](/s-p-8-d-e-or-white-paper/technical-quantra-manual/generator-start-manual/install-and-configure-generator.md) before.

<mark style="color:red;">**IMPORTANT only for Testnet:**</mark> QRNG tokens are required to buy randoms. They can be obtained via [faucet service](/s-p-8-d-e-or-white-paper/technical-quantra-manual/generator-start-manual/creating-accounts-testnet-and-faucet-service.md#faucet-service)

1. To install the application, download the following script in command:\
   `curl https://raw.githubusercontent.com/quantum-sp8de/quantra-installer/master/install_qrandom.sh -o install_qrandom.sh`
2. After the download is completed, you must issue the rights to execute the script \
   `chmod 777 install_qrandom.sh`
3. After setting the rights, you can call the script \
   `sudo ./install_qrandom.sh -r user`&#x20;
4. After installation you can start buying random

Save your private key to a text file that will be used by quantrapy later

```bash
cd ~
echo "Private key: <PRIVATE KEY>" > user_pk.key
```

After saving the key, to purchase a random item you need to run the command:

```bash
quantrapy --url <NODE ADDRESS> random -c quant.random -t quant.token buyrandom -k ~/user_pk.key <account name>
```

Example result:

<figure><img src="https://3112201423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvE1qTxK5RQkiRxrDR1jq%2Fuploads%2FKelQOM2Sf5kRHj9qGwQL%2Fimage.png?alt=media&amp;token=3eb496f5-d98c-407e-a1bd-f109b62633e5" alt=""><figcaption></figcaption></figure>

If you are a validator node in the sp8de network, you can also purchase random by running 2 commands through cleos:

```bash
cleos -u <node address> push action quant.token transfer '["<An account that buys randoms>", "quant.random", "50.00 QRNG", "buy random"]' -p <An account that buys randoms>
cleos -u <node address> push action encodingctrt encdecval '["<An account that buys randoms>", "quant.random"]' -p <An account that buys randoms>
```

Example result:

<figure><img src="https://3112201423-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvE1qTxK5RQkiRxrDR1jq%2Fuploads%2FdtEGCxA6WQ8ShhsfJFrJ%2Fimage.png?alt=media&amp;token=e7a6aa69-b727-4e03-b65f-2072009f9357" alt=""><figcaption></figcaption></figure>
