How SX Works
How SX's blockchain-based betting protocol works under the hood
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.
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.
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.
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.