> ## Documentation Index
> Fetch the complete documentation index at: https://developer.copper.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Example of the service

In order to familiarize yourself with the operation of Copper Unlimited Online, the Copper Team has a ready-made containerized example of the service to deploy on your side.

It looks like one more image to deploy together with Copper Unlimited Online and is available on <a href="https://hub.docker.com/r/copperexchange/hot-wallet" target="_blank">Copper DockerHub</a>.

The application works as follows:

1. The application pulls orders in the `working` and `awaiting-settlement` statuses using the Copper public API. If there are no orders available, the application enters sleeping mode for 10 seconds.
2. Then, the application takes the first order, and if it is in the `awaiting-settlement` status, moves it to the `working` status.
3. After this, it triggers the order signing request to the Copper Unlimited Server.
4. The application waits until the request is either in the `completed` or `error` status.
5. If the request is in `error` status, it fires an error; if it is in `completed`, it repeats the whole process starting from the first point.

To deploy and test the service, perform the following steps:

<Steps>
  <Step title="Configure your docker-compose.yml">
    ```yaml theme={"system"}
    version: "3.7"
    services:
      cu-server: # Copper Unlimited Online service
        container_name: cu-server
        image: copperexchange/copper-unlimited:latest
        ports:
          - "3010:3010"
        volumes:
          - ${PWD}/key-backups/:/app/keys/                  # Specify the correct path to your shards before the colon
        environment:
          APP_ENVIRONMENT: "testnet"                        # Specify the environment where you are going to use the service. Possible variants: "testnet", "demo" or "mainnet"
          APP_NETWORK: "testnet"
        restart: always
        healthcheck:
          test: "timeout 10s bash -c ':> /dev/tcp/127.0.0.1/3010' || exit 1"
          interval: 30s
          timeout: 10s
          retries: 10
          start_period: 10s
        networks:
          - cu-network

      hot-wallet:
        image: copperexchange/hot-wallet:latest
        depends_on:
          - cu-server
        volumes:
          - ${PWD}/wallets-config.js:/app/wallets-config.js # Specify the correct path to your wallet-config.js file before the colon.
        environment:
          APP_ENVIRONMENT: "testnet"                        # Specify the environment (see above)
          APP_CUSTODY_DOCKER_URL: "http://cu-server:3010"   # Link to the CU Online container
          APP_API_KEY: ""                                   # Your API key from the desired environment
          APP_API_SECRET: ""                                # API secret associated with the API key
          APP_WITHDRAWAL_PASSWORD: ""                       # Your Master password
        restart: always
        networks:
          - cu-network

    networks:
      cu-network:
        driver: bridge
    ```
  </Step>

  <Step title="Provide shards">
    Backup your wallet shards and place them in the directory specified as an external volume for the `cu-server` container (in the
    example: `${PWD}/key-backups/`). Do not forget to activate the created wallets in the desired platform environment and request to
    switch the corresponding vaults to hot if it has not been done before.
  </Step>

  <Step title="Configure wallets">
    The `wallets-config.js` file contains details of the shards. Below, you will find an example of the configuration with comments:

    ```js theme={"system"}
    module.exports = [
        {
            portfolioId: 'ckuwfho1y000p3e626z2zmmoy',         // Identifier of the portfolio containing the wallet
            currency: 'SOL',                                  // Wallet currency
            walletFilename: 'sol-wallet.copper',              // Name of the file containing the wallet shard
            walletPassword: process.env.SOL_WALLET_PASSWORD,  // Password
        },
        {
            portfolioId: 'cd213vvo1y000p3e62dd21dhy',         // You may specify as many shards as needed separating details with commas
            currency: 'ALGO',
            walletFilename: 'algo-wallet.copper',
            walletPassword: process.env.ALGO_WALLET_PASSWORD,
        },
    ];
    ```

    Place this file in the directory specified as an external volume for the `hot-wallet` container (in the example: `${PWD}/wallets-config.js`).

    As per the example, the resulting file composition on this step looks as follows:

    ```
    /${PWD}
    ├── key-backups
    │ ├── sol-wallet.copper
    │ └── algo-wallet.copper
    ├── docker-compose.yml
    └── wallets-config.js
    ```
  </Step>

  <Step title="Start your service">
    Start your service with the use of the `docker-compose up --build` command.
  </Step>

  <Step title="Create withdrawals and sign">
    Use the specified environment of the Copper Platform to create withdrawal orders. They will be signed and pushed forward
    automatically.
  </Step>
</Steps>
