Betting contract
Working draft, v0.1Peer-to-peer sports wagering on the Streembit blockchain: bettors take opposing positions under explicit terms, the contract holds the collateral, named validators report the result and the contract pays out by the agreed rules. The protocol takes no house position.
At a glance
| Contract | betting_v1, one system contract |
|---|---|
| Currency | SBRIT only, for wagers and settlement |
| Markets | One binary proposition per market: moneyline, spread or total; TRUE, FALSE or VOID at finalisation |
| Prices | Integers from 0 to 1,000,000,000 expressing the implied probability of TRUE |
| Result reporters | 1 to 7 ACTIVE validators named in the market terms, with a quorum |
| Reporter fee | 1% of the settled pot, shared equally by the reporters whose signatures finalise the result; none on a void result |
| Recovery | After the market's recovery time anyone may finalise it at the cancel price, 50/50 by default |
| Minimum trade | 0.0001 SBRIT at risk on either side |
Purpose
The Betting contract lets two bettors take opposite sides of a proposition about a sporting event and commit SBRIT to back their positions. The contract enforces the funding requirements, records every accepted wager and distributes the funds according to settlement rules fixed when the market was created. There is no bookmaker: every wager is between bettors, and the protocol takes no house position and charges no protocol or Treasury fee.
Identity checks, geographic restrictions and licensing belong to the application provider that displays markets and relays orders. An application's acceptance or display of an order never creates a wager; only the on-chain state transition does.
Participants
- Bettors create or fill standing orders and fund their obligations. A fill is accepted only if the resulting positions are fully collateralised.
- Result reporters are ACTIVE validators named in a market's terms. They sign outcome statements and have no authority over collateral. Their locked validator deposits serve as reporting bonds, and governance may slash a reporter after a misreport is adjudicated.
- Accountable Nodes and validators otherwise perform their ordinary consensus duties. Accountable Nodes never act as counterparties and never determine outcomes.
- Application providers display markets, run order books or matching services and communicate transactions. None of this changes what the contract accepts.
Markets
Anyone creates a market on chain by submitting its terms: the event, described by sport, league, kick-off time and the two teams; the proposition, a moneyline on a team, a point spread with a line, or a total with a line, plus a hash of the grading rules the reporters will apply; the named reporters and their quorum; an optional acceptance cut-off, without which in-play betting continues until finalisation; a recovery time after which the market can be closed without a result; and the cancel price paid when no outcome can be determined. The market's identifier is the hash of these terms, so the same terms cannot be created twice and the terms can never be changed.
A market is OPEN until it is FINALIZED, either by a quorum of reporter signatures or by recovery, and it never leaves that state. Kick-off may be at most 90 days ahead and recovery at most 30 days after kick-off, so every reporting obligation is bounded in time when the market is created.
Orders and trades
A maker signs an order off chain: the market, the direction, the price, the maximum SBRIT at risk, an expiry and a cancellation nonce, optionally restricted to one taker. Orders travel inside a taker's trade transaction; the contract verifies the signature and the terms and fills what it can. One order may be filled partially and by several counterparties, and orders sharing a maker, amount and group share one fill counter, so a maker can cap total exposure across several markets.
Every trade is split so that the long side risks the price share and the short side the remainder, and the two always add up to the trade size exactly; the contract never holds less than the sum of positions. An existing position can serve as collateral for a trade in the opposite direction, so a bettor can reduce or close a position before settlement without new funds. All cash flows for one address within a call are netted into a single balance change. Makers cancel by group or all at once through a nonce that only ever increases, and a match-orders call lets an arbitrageur fill opposing orders atomically while ending with no position.
Settlement
- Report. Each named reporter signs the outcome, TRUE, FALSE or VOID, never a price. The contract derives the final price from the outcome.
- Finalise. Anyone submits the signatures. Signatures count only from named reporters who are still bonded; once the quorum is met the market is finalised atomically, the 1% reporter fee is taken from the collateral backing the remaining positions and shared equally among the signing reporters, with any indivisible remainder to the first.
- Claim. Anyone may trigger payment for position holders. Winners receive their payout less the fee share; losing positions are zeroed. Each position is paid once. Rounding remainders of at most 0.00000001 SBRIT per position stay in the contract as dust.
- Recover. If no quorum arrives by the recovery time, anyone may finalise the market as VOID at the cancel price with no reporter fee. Whichever of finalisation or recovery is applied first stands; the other is rejected.
- A finalisation is never reversed. Slashing a reporter is a penalty on the reporter, not compensation to bettors.
Reporter duties and cases
Reporting is a mandatory duty of named validators; consent is not asked. A validator remains bonded while it has open markets, for seven days after the last market naming it was finalised, and while any case against it is unresolved. Within that seven-day window anyone may open a case against a reporter, posting a 100 SBRIT bond: a misreport case when the reporter's signature was used to finalise a wrong outcome, or a non-reporting case when the market had to be recovered. Governance resolves the case within 30 days under its multisig policy. A dismissed case pays the bond to the accused validator; an upheld case is closed once the validator protocol records the penalty, and the bond returns to the opener. A case nobody resolves times out without penalty.
What the contract guarantees
- Every movement of funds is attributable to an authorised transition and reproducible from the ledger.
- The contract's SBRIT balance always covers outstanding collateral, unpaid claims and unpaid reporter fees; funds received outside the protocol's flows are kept as surplus and never used to cover obligations.
- The sum of all positions in a market is zero, and the contract never creates an unfunded payout or pays the same entitlement twice.
- Accepted terms are never changed unilaterally; reporters cannot be added or removed after creation.
Contract methods
| Method | Caller | Effect |
|---|---|---|
| initialize | Deployer, once | Stores the governance signers and threshold used to resolve reporter cases |
| createMarket | Anyone | Validates the terms and reporters and stores the market as OPEN |
| trade | Taker | Fills one or more signed orders in sequence and returns the status of each |
| matchOrders | Arbitrageur | Fills opposing orders atomically with the caller's position unchanged |
| cancelGroup | Maker | Cancels every order in one of the maker's order groups |
| cancelAll | Maker | Increments the maker's nonce, invalidating all orders signed under the previous one |
| finalize | Anyone | Checks the reporter quorum, records the outcome and pays the reporter fee |
| claim | Anyone | Pays the position holders of a finalised market |
| recover | Anyone | Finalises an open market at the cancel price after the recovery time |
| openCase | Anyone | Opens a misreport or non-reporting case against a named reporter, locking a 100 SBRIT bond |
| addEvidence | Case opener | Appends evidence to an open case |
| resolveCase | Governance | Dismisses the case or upholds it pending the penalty |
| closeCase | Anyone | Closes an upheld case once the penalty is recorded, refunding the bond |
| timeoutCase | Anyone | Times out an unresolved case at its deadline, refunding the bond |
Protocol document
Streembit Betting Protocol
Version 0.1, Working draft. This page summarises the document; the document is the normative text.
Download Markdown All documentsOn this page
- Purpose
- Participants
- Markets
- Orders and trades
- Settlement
- Reporter duties and cases
- What the contract guarantees
- Contract methods