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

# 4. Go live

# 4. Go live

> **In short.** You connect your Polymarket account to the app, test it with real orders of
> the minimum size, and then turn on trading. Do the steps once, in order. Until the last
> step, the app cannot place a real order outside the test.

Until now the app ran with `LIVE_TRADING=false` and no account. This page adds a Session Key:
a key that can trade for your account but is not the account's main (owner) key. Every
setting named here is explained in [configuration.md](../configuration.md).

## Before you start

You need:

* Pages [1](1-prepare-server.md), [2](2-first-deploy.md) and [3](3-backups.md) done, with a
  passed [restore test](3-backups.md#step-4-test-a-restore).
* Your owner machine: the computer that holds the owner key of your Polymarket account. It
  is never the server.
* To be in a location where Polymarket permits you to trade.

WARNING: Never put the owner key on the server or in `sesame.env`. A person who gets the owner
key controls all the money in the account.

## Step 1. Run the security checklist

Do the [security checklist](advanced.md#security-checklist) on the server.

1. Do checks S1 to S9. Record the date, the release tag and the output of each check.
2. Do check S10.

Do not continue until S1 to S10 pass.

## Step 2. Create the Session Key

Follow [Session Key setup](../../runbooks/session-key-setup.md), sections 1 and 2.

* Create the key pair on the server, so the private key never leaves it.
* Authorise it from your owner machine.
* To use Combos, give the key the combos scope too
  ([section 8](../../runbooks/session-key-setup.md#8-combos-scope)).

At the end you have three values:

| Value | Where it comes from |
| - | - |
| The Deposit Wallet address | The profile menu on polymarket.com |
| The Session Key's private key | The key pair you created on the server |
| The owner address | Your wallet app. This is the public address only, never the owner key |

## Step 3. Add the account settings

CAUTION: Cancel every open order on polymarket.com before you do this step. At its first
start with the key, the app takes every open order as its own
([live verification, PF3](../../runbooks/live-verification.md#14-pre-flight)).

1. On **the server**, open the settings file:

   ```sh theme={null}
   sudoedit /opt/sesame/sesame.env
   ```

2. Add these three lines, with your values:

   ```dotenv theme={null}
   POLYMARKET_WALLET_ADDRESS=<Deposit Wallet address>
   POLYMARKET_SESSION_KEY=<Session Key private key>
   POLYMARKET_OWNER_ADDRESS=<owner address>
   ```

3. Add the eight `RISK_CEILING_*` lines with the test values from
   [live verification, section 1.1](../../runbooks/live-verification.md#11-risk-limits-for-the-run).
   The app reads the ceilings only when it starts.

4. Make sure that the file still has `LIVE_TRADING=false`.

5. Save and close the file.

6. On **your computer**, in the repository folder, restart the app:

   ```sh theme={null}
   task deploy:start
   ```

   Enter the security key's PIN and touch it, or type the passphrase. The command ends with
   a list of the two containers, `sesame-sesame-1` and `sesame-caddy-1`.

If the command stops with an error, the app found a wrong setting. Go to
[The deploy stops and the app does not start](troubleshooting.md#the-deploy-stops-and-the-app-does-not-start).

## Step 4. Check the credential state

1. Log in to the app and open **Settings**.
2. In **Account**, find **Credentials**. It shows **Connected**.
3. Make sure that **Signer address (Session Key)** is the address of the key you created in
   Step 2. It must not be the owner address.
4. Make sure that **Wallet address (Deposit Wallet)** is your Deposit Wallet address.
5. On **your computer**, read the app's log:

   ```sh theme={null}
   task deploy:logs -- sesame
   ```

   Find the line with `baseline orders adopted`. It shows `"orders":0`.

| What you see | What to do |
| - | - |
| **Connecting** | Wait one minute, then open **Settings** again |
| **Account error** · `Account credentials failed: wallet_mismatch` | The key is not a signer of this wallet. See [Session Key troubleshooting](../../runbooks/session-key-setup.md#7-troubleshooting) |
| **Account error** with another reason | See [Session Key troubleshooting](../../runbooks/session-key-setup.md#7-troubleshooting) |
| **Not connected** or **Read-only** | A setting from Step 3 is missing. The message names it |
| `"orders"` above 0, or a `baseline order adopted` line | Stop. Do not arm. Follow [live verification, section 3](../../runbooks/live-verification.md#3-if-a-step-fails) |

## Step 5. Run the live verification

The [live verification](../../runbooks/live-verification.md) places real orders of the
minimum size and checks each result. It needs `LIVE_TRADING=true`, with the low test ceilings
from Step 3.

1. On **the server**, open the settings file:

   ```sh theme={null}
   sudoedit /opt/sesame/sesame.env
   ```

2. Change the `LIVE_TRADING` line to:

   ```dotenv theme={null}
   LIVE_TRADING=true
   ```

3. On **your computer**, restart the app:

   ```sh theme={null}
   task deploy:start
   ```

4. Do the live verification from its section 1 to its section 6. Use minimum sizes only.

The runbook is written for an app on your own computer. On the server, use these in its place:

| The runbook says | On the server |
| - | - |
| `.env` | `/opt/sesame/sesame.env`, opened with `sudoedit` |
| Restart the app | `task deploy:start`, on your computer |
| `task dev`, and the log file in section 1.3 | `task deploy:logs -- sesame` for the last 300 lines. For more, run `cd /opt/sesame && sudo docker compose logs sesame` on the server |
| `http://localhost:5173/api/...` | `https://<your-domain>/api/...`, while you are logged in |

If a step fails, stop and do
[section 3 of the runbook](../../runbooks/live-verification.md#3-if-a-step-fails). It turns
trading off again.

## Step 6. Turn on live trading

Do this step only when every step of the live verification passed.

1. In the app, press **Cancel all**. Make sure that polymarket.com shows no open order from
   the test.

2. Set the switch to **Safe**.

3. On **the server**, open the settings file:

   ```sh theme={null}
   sudoedit /opt/sesame/sesame.env
   ```

4. Change the eight `RISK_CEILING_*` lines to the values you want for normal trading. To use
   the defaults, delete the lines.

5. Make sure that the file has `LIVE_TRADING=true`.

6. On **your computer**, restart the app:

   ```sh theme={null}
   task deploy:start
   ```

7. In the app, raise your risk limits one at a time
   ([Change a risk limit](../user/settings.md#change-a-risk-limit)). Each raise asks for your
   login password. A limit cannot go above its ceiling.

8. Set your stake presets last
   ([Change your stake presets](../user/settings.md#change-your-stake-presets)). A preset
   cannot be above the maximum order notional.

## Is it working?

| Check | How | Expected |
| - | - | - |
| Trading is on | Log in, then open `https://<your-domain>/api/status` | `"trading_enabled":true` |
| Trading is on, in the app | **Settings**, then **Session**, then **Trading** | **Enabled** |
| The account is connected | **Settings**, then **Account**, then **Credentials** | **Connected** |
| The app starts safe | Look at the trading switch after each start | **Safe**. Arm it to trade ([Getting started](../user/getting-started.md)) |

If trading stays off, see
[The app runs but trading stays off](troubleshooting.md#the-app-runs-but-trading-stays-off).

The Session Key expires 180 days after you authorise it. Write down the date. From 14 days
before it, **Settings**, then **Account** shows **Session Key expiry**. Replace the key before
it expires ([Rotation](../../runbooks/session-key-setup.md#5-rotation)).

Previous: [3. Backups](3-backups.md) · Next: [Day to day](day-to-day.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.