# Claim Rewards

When a data submission wins a target, the reward splits 50/50 between the data submitter and the winning model. Rewards become claimable after a challenge window of 2 epochs, during which validators [audit](https://docs.soma.org/concepts/submitting/#resolution) the submission. If the submission passes audit, the reward is claimable. If it's fraudulent, the submitter's [bond](https://docs.soma.org/concepts/economics/#bonds) is forfeited.

**Anyone can claim rewards for any target** — you don't have to claim your own. The claimer receives a **0.5% finder's fee** from the reward pool as an incentive. In practice, this means bots will claim settled targets automatically, and your rewards will flow to your wallet without you doing anything. The script below is useful for claiming immediately or if you want to collect finder's fees yourself.

For more on reward mechanics, see [Economics](https://docs.soma.org/concepts/economics/).

> Source: [`settle_targets.py`](https://github.com/soma-org/quickstart/blob/main/src/quickstart/settle_targets.py)
**Prerequisites:** - Quickstart repo cloned and `.env` configured with `SOMA_SECRET_KEY` ([Quickstart: Clone and configure](https://docs.soma.org/getting-started/quickstart/#clone-and-configure))

## Claim your rewards

```
uv run claim
```

This runs `settle_targets.py`, which finds all claimable targets and claims rewards for each:

```python
async def run():
    secret_key = os.environ.get("SOMA_SECRET_KEY")
    if not secret_key:
        print("Error: SOMA_SECRET_KEY not set in environment or .env file")
        return

    kp = Keypair.from_secret_key(secret_key)
    sender = kp.address()
    print(f"Sender: {sender}")

    client = await SomaClient(chain="testnet")

    balance = await client.get_balance(sender)
    print(f"Balance: {balance:.2f} SOMA")

    targets = await client.get_targets(status="claimable", submitter=sender)
    print(f"Found {len(targets)} claimable target(s)")

    if not targets:
        print("Nothing to settle.")
        return

    settled = 0
    for target in targets:
        print(f"\nSettling target {target.id} (reward_pool={target.reward_pool})")
        try:
            await client.claim_rewards(signer=kp, target_id=target.id)
            print(f"  Settled {target.id}")
            settled += 1
        except Exception as e:
            print(f"  Failed to settle {target.id}: {e}")

    balance = await client.get_balance(sender)
    print(f"\nSettled {settled}/{len(targets)} target(s)")
    print(f"Balance after settling: {balance:.2f} SOMA")
```

The script is registered as a CLI entry point in `pyproject.toml`, so `uv run claim` works directly from the quickstart repo.

## How rewards work

When a target is filled, the reward splits:

- **50% to the data submitter** who found data within the [distance threshold](https://docs.soma.org/concepts/targets/#distance-threshold)
- **50% to the winning model** whose weights produced the lowest loss on that data

Both parties must claim their share explicitly. Rewards are locked for a **2-epoch challenge window** after submission. During this window, a random validator audits the result.

**Model developer rewards** (commission) are claimed the same way. Claimed commission is added to your model's stake pool, automatically increasing your [routing priority](https://docs.soma.org/concepts/targets/#model-assignment) and chance of being assigned to future targets. You can [unstake](https://docs.soma.org/reference/sdk/scoring-admin/#withdraw_stake) at any time.

## Merge coins after claiming

Each claim creates a separate coin (SOMA object) in your wallet. After claiming many targets, you may have hundreds of small coins. This can cause `InsufficientBond` or gas payment errors on future transactions, because the network requires a single coin large enough to cover the bond or gas — it won't automatically combine them.

Merge your coins periodically to consolidate them into one:

```
soma merge-coins
```

Or via the SDK:

```python
await client.merge_coins(signer=kp)
```
**Tip:** `merge_coins` merges up to 256 coins per call. If you have more than 256, run it multiple times. The quickstart submitter calls `merge_coins` before each submission to avoid bond errors.

## Check claimable rewards

```
soma target list --claimable
```

The CLI shows claimable targets and their reward pools.

## Next steps

[Continuous Training](https://docs.soma.org/guides/model-development/)

[Model Strategies](https://docs.soma.org/guides/model-strategies/)

[Data Strategies](https://docs.soma.org/guides/data-strategies/)