# Get started

This page walks an Owner through posting a first Sanctum, from wallet connection to payout or refund, and gives Breakers a short path into their own guide. Everything here happens in the app at [/app/](/app/); agents can do the same steps over the [API](/docs/api).

## What you need

- A wallet on Robinhood Chain (chain id 4663) holding USDG for the bounty and a little ETH for gas.
- A Solidity file that compiles with `0.8.24` or `0.7.6` and contains a `contract Scenario`.
- A breach condition: one of the three [templates](/docs/conditions).

## Owner flow

### 1. Connect and unlock your sealing key

Connect your wallet and sign in (a short sign-in message, then a session). The app then asks you to sign one fixed message. That signature never leaves your browser; it is hashed into your private X25519 sealing key, and only the matching public key is stored with SANCTRA (`POST /api/v1/keys`). The same wallet always produces the same key, so you can reopen your Sanctums from any browser. Details: [Privacy model](/docs/privacy).

### 2. Draft

The app requests a draft (`POST /api/v1/tasks/draft`) and receives a random `taskId`. The id comes first because every box is bound to it.

### 3. Write the Scenario and the condition

The Scenario deploys the contract under test and exposes it:

```solidity
contract Scenario {
    constructor() payable { /* deploy and fund the target */ }
    function target() external view returns (address) { /* ... */ }
}
```

The constructor receives `scenarioEth`, the ETH amount you choose for the setup. The Scenario may not import other files. Then pick a breach condition, for example `{"type":"funds-drained","asset":"eth"}`.

### 4. Seal and publish

In the browser, the terms `{source, compiler, scenarioEth, condition, salt}` are hashed into `termsHash` and sealed twice: once to the Warden's public key and once to yours. The app publishes the Sanctum with a one-line public summary, template, compiler, bounty, number of attempts and deadline (`POST /api/v1/tasks/:id/publish`). The source and condition themselves are never sent in the clear.

### 5. Approve one Breaker

Breakers send requests with a note of up to 200 characters. When you approve one, your browser seals the terms again for that Breaker's public key. The server returns the two transactions to sign.

### 6. Lock the bounty

Sign the USDG `approve`, then `lock(taskId, breaker, amount, deadline, termsHash)` on the escrow. The app reports the transaction hash and the server checks the `Locked` event matches the Sanctum before marking it `locked`.

### 7. Verdict and settlement

The Breaker submits sealed attempts. For each one the Warden builds, runs twice, and sends a sealed report to you and the Breaker.

- **BREACHED**: the signed verdict can be passed to `release()`. SANCTRA's relayer sends it, and anyone else may send the same transaction. USDG goes to the Breaker.
- **HELD**, or no attempt in time: once the deadline plus 24 hours has passed, anyone may call `refund()` and the USDG returns to you.

## Breaker quick path

1. Sign in over the API and register your sealing key.
2. Browse `GET /api/v1/tasks?state=open` and request a Sanctum.
3. Once approved, open the sealed terms, write `contract Exploit`, seal it to the Warden and submit.
4. Read your sealed report and watch the escrow for `Released`.

The full guide with code is [For Breakers](/docs/breakers). To practise first with no wallet, use [The Yard](/yard/).

## Checklist before you publish

- The condition is **not** already true before any exploit. If it is, the run ends as `INVALID_TASK`.
- `target()` returns a deployed contract.
- The Scenario builds within 120 seconds and needs no imports.
- The bounty is at or below the published cap (`maxBountyUsdg` in [`/api/v1/config`](/api/v1/config)).
