Bet blueprint
Introduction
This article introduces the bet blueprint for those who have decided or are considering using it in their use cases. We will cover:
- which classes of use cases can be modeled using the bet blueprint;
- the terminology to be employed in the context of bet contracts;
- how to use it;
- how it works; and
- the specifications for modeling a use case with this blueprint.
Currently, this blueprint is available for testing purposes only. It was conceived to demonstrate how blueprints function and provide insight into the design, implementation, and documentation processes for future blueprints.
Glossary
These terms are used throughout this article:
-
Nano contract is a type of smart contract exclusive to Hathor technology. Every smart contract deployed on Hathor blockchain is referred to as a nano contract. The distinguishing factor of a nano contract compared to a conventional smart contract is that Hathor platform provides contract templates, making it possible to create contracts on Hathor blockchain without needing to develop their code.
-
A blueprint is the source code that models a general category of nano contracts use cases and serves as a template for creating nano contracts.
Use cases
This blueprint was conceived to implement bet nano contracts for the following use cases:
- Skill-based games
- Gambling
- Prediction markets
Skill-based games are those that require skill, strategy, or knowledge to play and succeed, such as sports, esports, tabletop games (chess, etc.), etc. Gambling are those games based purely on luck or chance. Prediction markets are speculative financial markets where participants trade contracts based on the outcome likelihood of specific events, harnessing the "wisdom of the crowd" to generate predictions.
Terminology
Each blueprint has its own terminology. In the context of the bet blueprint, we will use the following terms:
- Bet: an agreement among multiple parties, where each party wagers on a different result for a future event, with the intention of winning additional value from the opposing party(ies) if their prediction is correct.
- Bettor: someone who places a bet.
- Wager: the amount of assets of a bet.
- Result: the outcome of the event.
- Betting option: a bet opportunity available for bettors, related to a specific future event.
- Betting event: the event of a betting option.
- Bookmaker: someone who creates betting options.
- Place a bet: the act of a bettor, of commiting a wager and a result prediction to a betting option.
- Handle: the collective amount of assets wagered by all bettors.
- Commission: fee that the bookmaker takes on bets.
- Winning bet: a bet that correctly predicted the result of the betting event.
- Winning bettor: a bettor who placed a winning bet.
- Winnings: the amount of assets earned by bettors who correctly predicted the result of a betting event (including the original wager plus profit).
- Betting platform: an online platform that provides the infrastructure and services for customers to engage in betting activities. Also, it may serve as an intermediary among bettors and bookmakers.
How to use it?
As any other blueprint, bet blueprint can either be used to create contracts directly via Hathor headless wallet or serve as a base for creating new blueprints (inheritance). New blueprints can extend its functionality by implementing features such as fee collection by the house, bets against the house, odds, parlays, spread betting, live betting, etc.
How does it work?
A bookmaker creates a bet contract to model their betting option. Once the contract has been created, bettors can place their bets, up until the date and time set as a limit. Thereafter, the contract will no longer accept bets, and will wait for the oracle to set the result of the betting event. Once the result has been set, winning bettors can withdraw their winnings. In a nutshell, this is the typical workflow of a bet contract. To understand how it works in detail, see Bet blueprint: how it works.
Specifications
In this section, we present the key specifications of the bet blueprint:
- The bet blueprint can only model peer-to-peer betting (i.e., bettors against bettors, there is no house).
- Each bet contract models a single betting option. If a bookmaker wants to offer multiple betting options for the same betting event, it needs to create multiple bet contracts — one for each betting option.
- A bet contract works with one and only one fungible token — either HTR or any custom token. That is, when creating a contract, the creator (bookmaker) defines the token that users (bettors) will place bets with.
- The bookmaker can set the date and time limit at which bets can be placed.
- The bookmaker defines one and only one oracle to set the result of the betting event. This oracle may be itself or any other reliable third party.
- The bookmaker communicates the details of the betting contract to bettors in an off-chain manner. For example: the contract ID, what is the event, and the regular expression that defines the possible results.
- There is no bet limit for a single bettor.
- Once placed, a bet cannot be undone.
- A winning bettor can cash out their winnings to any wallet — not necessarily their own — in any number of withdrawals.
- Once released, there is no time limit for withdrawing winnings. As long as Hathor Network is up and running, contract withdrawals can be made.
- If no bettor guesses the result, the funds remain permanently locked in the contract. For a small set of possible outcomes, the contract creator (bookmaker) can mitigate this issue by placing at least a small bet on each possible outcome.
- In gambling use cases, it is up to the oracle to attribute the fairness and randomness of the outcome, not the contract.
What's next?
- Bet blueprint — how it works: to understand the conceptual implementation of the bet blueprint into a use case.