Sports betting

Make sports bets peer-to-peer or through the betting bot.

## Sports betting on Byteball

Byteball allows you to safely bet on sporting events by making a conditional payment that depends on a match result posted into the DAG by a third party (called the *sports oracle*). It’s one of easiest ways to bet using a cryptocurrency.

In March 2018 these professional leagues and championships were available for betting:

* Basketball: NBA (US National Basketball Association)
* Baseball: MLB (US Major League Baseball)
* Ice hockey: NHL (US National Hockey League)
* American football: NFL (US National Football League)
* MMA: UFC (Mixed Martial Arts: Ultimate Fighting Championship)
* Soccer: Champions League (EU), Ligue 1 and 2 (France), Premier League (UK), Primera División (Spain), Bundesliga 1 and 2 (Germany), Brasil Série A (Brazil), Primeira Liga (Portugal), Italian Serie A and B (Italy), League One and Two (UK), Eridivisie (Netherlands), World Cup, European Cup.

The sports oracle is operated by the Byteball lead developer. You can check the source code on Github.

There are two ways to bet on sport with Byteball:

* Completely P2P with someone that paired his wallet with yours. See #P2P\_betting
* Using the sports betting bot that acts as a betting marketplace and facilitates making the smart contracts. See #Betting\_bot

## P2P betting

To make a bet P2P you need to be in contact with someone that is willing to bet with you. You will both send to a smart-address an amount of bytes corresponding to the odds you have negotiated. Depending on the result, one of you will collect the total amount staked.

### Get the feedname

First you need to obtain the feedname of the desired fixture. This feedname will then be used in the contract you draw up. To get this feedname from the sports-oracle bot, follow these steps:

1. Click on: `Chat > Bot Store > Sports oracle > open chat`
2. Click on the championship corresponding to the desired fixture
3. Click on: `coming` fixture
4. Click on the desired fixture
5. The bot will give you a feedname similar to `BROOKLYNNETS_CHARLOTTEHORNETS_2018-03-21`. Copy and paste it somewhere (in your Notepad, for example) to keep it to hand.

### Pair with your peer

In order to execute a smart contract (called *conditional payment* in this case), you have to be paired with your peer/counterparty.

1. Click on: `Chat > Contacts > + Add a new device > Invite the other device`
2. Copy the pairing code and send it to your peer
3. Your peer has to click on: `Chat > Contacts > + Add a new device > Accept invitation from the other device`, and paste the received code.

You’re now in an encrypted chat with your peer and will be able to propose to him a conditional payment,

### Propose the conditional payment

1. Ask your peer to insert his address: he clicks on the 3 dots (…) at the bottom left, clicks on `Insert my address`, then sends it
2. You then left-click on his address and choose `Offer a contract`.

The contract is self-explanatory and describes the precise conditions under which you or your peer can take the funds staked.

You have to:

1. Select `Sports betting` as oracle
2. Paste the feedname obtained previously from the Sports oracle, for example: `BROOKLYNNETS_CHARLOTTEHORNETS_2018-03-21`

To bet on one team winning, for example Charlotte Hornets:

1. Select `=` as the logic operator
2. Use that exact team name as the `expected value`, namely `CHARLOTTEHORNETS`.

To bet on one team not winning (i.e., lose or draw), for example Charlotte Hornets:

1. Select `|=` as the logic operator
2. Use that exact team name as the `expected value`, namely `CHARLOTTEHORNETS`.

#### Notes

* On the third field, `take my money back after ___ hours`, the time-out should be set before the beginning of the fixture otherwise your peer would have an unfair advantage in deciding to fund or not fund the contract.

* On the last field, `after it expires in ___ days`, set a time at least 3 days after the fixture in case the oracle delays in posting the result.

* If the fixture is canceled or moved to a different day, the oracle will never post the feedname and the contract condition won’t happen. You have to consider the bet as a "show and win/not win" and the negotiated odds should consider that. If you want both parties to get a refund as they would with a casual bookmaker, then better use the betting bot as it offers a more elaborate contract.

#### Send the contract

When your contract is set up as you wish, send it. Your peer will get a payment request that shows him all the terms of the contract. The bet will be active after he has paid his share to it. If he won’t pay, you can get your stake back after the time in the `take my money back after ___ hours` field.

### Getting the payout

The sports oracle usually posts the result six hours after the fixture. It will send you a notification when the result is posted in the DAG and the payout is available.

If the posted result matches the condition set, you can get the payout immediately. If not, the peer has to wait until the end of the expiry time-out to get paid.

Getting the pay-out is done by moving the stakes from the smart address to one of your main addresses. To do it, go to your wallet Home and select the sub-wallet corresponding to the bet (click on wallet middle-top). Then click on Send and make a transaction that sends all the stakes to your main wallet. If the stakes are other than bytes, you will need to send bytes to the sub-wallet to cover the transaction fee. After the confirmation time, your funds will be available in your main wallet and ready to be spent.

## Betting bot

This chatbot is a marketplace where gamblers and bookmakers can meet. It is divided in two modes:

* **Taker mode:** This is the default mode which allows a gambler to place a bet with only a few clicks. A human-readable smart-contract is proposed so the gambler doesn’t have to trust the bot. The result is given by a third-party (the Sports oracle) and it is possible to get the payout even if the bot goes down.

* **Maker mode:** This is a more advanced mode for people wanting to earn bytes by acting as bookmakers. The bookmaker sets odds to be proposed for the fixtures of his choice. Then the bot proposes a smart-contract for gamblers willing to take the offered odds.

### Pairing with the chatbot

In order to use the betting bot, you need to pair with it. To do so, click on: `Chat > Bot Store > Betting bot (Semi-trustless) > Open chat`. Once paired you can access it at any time from `Chat > Contacts`.

### Selecting a bet

In the welcome text, the chatbot shows the best odds available for the upcoming fixtures. They are classified by time and you can browse them by clicking on  `next >>` or `<< previous`.

It’s possible to filter by sport by clicking on one of the sport icons:
Apply filter: 🏀 - ⚾ - ⚽ - ❄ - 🏈 - 👊.

If you don’t find the fixture you want, you may look again a few hours before it starts since most bookmakers tend to propose their odds then in order to not tie up their funds for a long time.

For every sport but soccer, two odds are shown. The first is the decimal odds for the home team winning, the second is the decimal odds for the away team winning.

For soccer three odds are shown, the middle one being the decimal odds for a draw.

If n/a appears instead of odds, it means that no odds have been set for this outcome and so it’s not possible to bet. You might consider coming back later since most bookies propose their odds only a few hours before the fixture.

     Once you have clicked on the desired odds, the bot indicates what the payout would be based on the amount of your stake. Since the bot selects the best offers from the different bookmakers, the resulting odds can decrease as long as the stake increases. You can click directly on a suggested amount, or you can type the precise amount you want to stake. After you’ve inserted your address into the chat as requested, you will immediately see a payment to a smart-address corresponding to your potential gain and you will be asked to pay your share to the bet.

### Paying the bet

Click on the payment request. A human-readable smart-contract will be shown. Scroll down, then click on `Send payment`. The bot will notify you that your payment is pending, and again some minutes later when it is confirmed.

### Getting the payout

 File:Zzbetbot-5.jpg  Usually six hours after the fixture, the result will be posted into the DAG by the oracle and the contract will be unlockable by one of the parties. The bot will register when the result is posted. It will notify you of the result: if you have won you will be invited to collect your winnings from the shared address.

As before, getting the pay-out is done by moving the stakes from the smart address to one of your main addresses. To do it, go to your wallet Home and select the sub-wallet corresponding to the bet (click on wallet middle-top). Then click on Send and make a transaction that sends all the stakes to your main wallet. After the confirmation time, your funds will be available in your main wallet and ready to be spent.

If you lost the bet, you don't need to do anything. The bot will collect all the bytes and the shared-address is not shown anymore in your wallet.

If the fixture is canceled or postponed, the oracle won’t post the feedname used by the contract. In such a case the contract allows the bot to collect the bytes five days after the fixture, and it will refund both parties.

## References

1. ↑ https://github.com/byteball/sports-oracle