> For the complete documentation index, see [llms.txt](https://docs.pretoke.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pretoke.xyz/how-it-works/settlement-explained.md).

# How Trades Settle On-Chain

Your positions aren't just numbers in a database — every trade is eventually backed by a real position recorded on the TON blockchain, secured by the platform's smart contracts. This page explains how that happens without slowing you down.

## Why "off-chain first, on-chain after"

Blockchain transactions take time to confirm — from a few seconds up to a couple of minutes depending on network conditions. If the app made you wait for a confirmation on every single trade, it would feel slow and clunky. Instead:

1. Your trade fills **instantly** in the order book / AMM, and your balance and positions update **immediately** so the app always feels responsive.
2. In the background, the platform queues the equivalent **on-chain operation** and submits it to the TON blockchain shortly after.
3. Once confirmed on-chain, your trade's settlement status flips to "confirmed" and a transaction hash becomes available for you to verify independently on a TON block explorer.

You never have to wait for step 3 to keep trading — but the guarantee is there if you want to check it.

## What actually happens on-chain

Depending on what you did, one of three things happens:

| Your action                                                   | On-chain operation | What it means                                                                                                                        |
| ------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| You buy YES or NO, and there's no matching opposite buyer     | **Split**          | New collateral is converted into outcome tokens (YES or NO) — a real, verifiable minting of your position backed 1:1 by locked USDT. |
| Two opposite buys cross each other (a YES buy meets a NO buy) | **Mint**           | Same underlying mechanism as a split — a complete YES+NO set is created from collateral and divided between the two buyers.          |
| You sell, or two opposite sells cross each other              | **Merge**          | Outcome tokens are converted back into collateral, releasing the USDT that was backing them.                                         |
| A market resolves and you claim your winnings                 | **Redeem**         | Your winning outcome tokens are exchanged for their USDT payout, based on the oracle's reported result.                              |

Each of these corresponds directly to an operation on the [ConditionRegistry](/smart-contracts/condition-registry.md) smart contract — the docs there describe the exact on-chain mechanics if you want to go deeper.

## Deduplication and reliability

Every settlement is tracked by a unique ID tied to the trade that caused it, so the same trade is never settled twice — even if there's a network retry or the settlement service restarts mid-operation. If an on-chain transaction doesn't land right away (e.g. momentary network congestion), the platform automatically retries with backoff rather than losing track of it.

## Checking a trade's settlement status

Your trade history shows each trade's settlement status. Once confirmed, you can look up its transaction hash on any TON block explorer (like Tonviewer or Tonscan) to see the raw on-chain transaction yourself — nothing about the settlement is hidden or trust-based beyond what the smart contract itself enforces.

## What about deposits and withdrawals?

Those are more direct: a deposit is simply detected when USDT arrives at your personal deposit address (a real on-chain address controlled by the platform's infrastructure), and a withdrawal is a direct USDT transfer sent from the platform's wallet to yours. Neither involves the conditional-tokens contracts — those are only involved in position splitting, merging, and redemption.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pretoke.xyz/how-it-works/settlement-explained.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
