# How SX Bet Works

### SX Protocol Overview <a href="#sx-protocol-overview" id="sx-protocol-overview"></a>

The SX protocol comprises the set of open source smart contracts that power the entire SX prediction market ecosystem. The protocol creates, processes, and settles all bets, on-chain. This protocol houses the control mechanisms, configurable fees, maintenance controls, and rules that govern the entire network. It also houses all the governance logic, including the processes by which SX stakers control the Community Treasury.

This section focuses exclusively on the actual process of creating and settling betting markets.

### 📝 Market Registry <a href="#market-registry" id="market-registry"></a>

The parts of the SX protocol that deal with market creation and settlement are relatively lightweight and simple to understand. First, betting markets are either created programmatically with a sports market API or manually through the market creator GUI dApp. Markets must contain six characteristics to be considered valid:

* gameTime: start time of the event
* teamOneName: name of the home team
* teamTwoName: name of the away team
* sportID: identification number of the sport
* leagueID: identification number of the league
* type: type of betting market (i.e. ML, Spread, or Total)

Once created, a market hash is generated and stored on the Market Registry.

### 🔏 Escrow Contract <a href="#escrow-contract" id="escrow-contract"></a>

Once a market hash is created, market participants can begin to offer and accept bets on the market. Once a bet has been offered and accepted on a market, the respective crypto assets of the two bettors are atomically transferred to the Escrow contract.

<figure><img src="https://docs.sx.technology/~gitbook/image?url=https%3A%2F%2F3317720348-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-McyBMb42B-FXPuOm8C6%252Fuploads%252FyY1x9sQ8pXeiaKS3yQDn%252FScreen%2520Shot%25202022-04-17%2520at%252012.59.22%2520PM.png%3Falt%3Dmedia%26token%3D5d8bc8d7-8f96-488b-bea3-774b25e149ec&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=dac31ad8&#x26;sv=2" alt=""><figcaption></figcaption></figure>

The crypto assets sit in the Escrow Contract until the creator of the market reports on the event. There are only three valid reporting outcomes: Outcome1, Outcome2, and Void. In the event of a Void market, both market participants are returned their respective stakes back, without paying any fees. This is standard practice in the sports betting industry in the event that a game is cancelled, postponed, or the bet outcome finishes in a tie.


---

# Agent Instructions: 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:

```
GET https://learn.sx.bet/developers/how-sx-bet-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
