COINFLIP game flow STEP BY STEP. Powered by TeFiLuck.

Contents

  1. Detailed guide
  2. Why have we designed it that way?
  3. Let’s stay in touch

1. Detailed guide

First, please take a close look at the following diagram which describes the whole flow.

Dictionary

  1. Game — coinflip game.
  2. Creator — the person who created the game.
  3. Acceptor — the person who accepted the game initiated by creator.
  4. Bulls — heads coin side, or “0” in smart-contracts.
  5. Bears — tails coin side, or “1” in smart-contracts.
  6. Choice encryption password — password which is used to encrypt creator’s choice, so it’s impossible for acceptor to know which side has been selected in advance.
  7. Game resolution— the phase when creator provides his choice encryption password to evaluate the game.
  8. Resolve time-limit — the amount of time measured in Terra blocks (1 block ~ 5 seconds). Tells how much time creator has to resolve the game before liquidation kicks in. Determined by creator when he creates the game. Publically visible.
  9. Liquidation — a situation, when creator has failed to provide choice encryption password in specified resolve time-limit. Acceptor or in some cases any person can end the game and it will be winnable for acceptor without consideration of end result.
  10. Private liquidation time-limit — the amount of time measured in Terra blocks (1 block ~ 5 seconds). Tells how much time acceptor has to liquidate creator until public liquidation kicks in.
  11. Public liquidation — a situation when acceptor failed to liquidate his opponent in private liquidation time-limit and now game might be ended by anyone from the public. Liquidator will be rewarded with liquidator fee for this. However, most of the profit still belongs to the acceptor.
  12. Game fee — a certain % of the pot size which TeFiLuck charges from each resolved game. We will have it at 0% when we launch.
  13. Platform liquidation fee — a certain % of the pot size that TeFiLuck charges from the liquidated game.
  14. Liquidator fee — a certain % of the pot size from liquidated game to reward liquidator.

Step by step

We recommend trying all the following steps on TESTNET first to avoid any possible confusion on MAINNET. You are responsible for your actions.

  1. Creator initiates the game, he must provide the following data:
    - Bet size
    - Resolve time-limit
    - Encrypted side choice STRICTLY in this format (don’t worry our front-end handles all complexity for you): SHA256(side_password)
    - IMPORTANT: YOUR PASSWORD MUST BE UNIQUE AND COMPLEX. EACH TIME YOU CREATE A GAME, NEVER USE 1 PASSWORD TWICE. PREFER TO USE AUTO-GENERATED PASSWORD, WHICH WE PROVIDE TO YOU. IT’S A SUPER-SAFE CRYPTO-RANDOM GENERATED STRING OF 255 SYMBOLS.
    - We will auto-download the password in the TXT file, plus you will have an opportunity to save it locally. However, we still advise storing a copy of it someplace.
  2. WHILE the game is not accepted, creator can withdraw his funds and cancel the game.
  3. Acceptor gets into the game. It’s going to be as easy as clicking 1 button and confirming transaction on Terra Station wallet.
  4. After the game is accepted, creator must resolve the game with choice encryption password within resolve time-limit.
  5. GAME EVALUATION: If acceptor guesses the creator’s side, acceptor wins otherwise creator wins.
  6. If the game is not resolved during resolve time-limit period, the acceptor will be prioritized to liquidate the creator during the private liquidation time-limit.
  7. If during private liquidation time-limit, creator has not resolved the game or acceptor has not liquidated the creator then creator can be liquidated by anyone. There’s a liquidator fee to incentivize public liquidation.

2. Why have we designed it that way?

Well, we obviously didn’t want to overcomplicate things for our users but unfortunately, we just didn’t have another approach on how to develop coinflip so it remained 100% fair and random but at the same time scalable for potential high-volume usage in smart-contracts environment.

What’s the main issue?

Unlike in “normal” programming, in smart-contracts, you don’t have access to randomization and current timestamps(that’s why we measure time in blocks) because smart-contracts operate in isolated environment. That’s why we can’t use crypto-random or other random libraries.

So what solutions could we possibly take:

- Use oracle which will feed smart-contract with random data from 3rd party.

- (OUR CHOICE) Implement commit and reveal algorithm to secure randomness.

The problem with the oracle

So, there’s a number of problems with using oracle to provide us with random numbers.

  • We depend upon 3rd party and this hurts decentralization.
  • Although it seems that there is a solution called DRAND which is utilized by Loterra, we still can’t rely on it because it’s not scalable in the long run due to the potentially large volume of games.
  • It’s not cost-efficient enough, because we have to pay fees for submitting data in smart-contract.

End result

So, in the end, we are left with just one possible solution which is multi-step. However, with great care to UX, we believe it possible to keep it convenient for users — commit and reveal approach.

We hope, dear reader — you now understand every little thing about our implementation of the coinflip game. If you have any further questions or doubts feel free to contact us via e-mail or explore our open-source code-base.

Anyway, we encourage you to try everything on TESTNET first, and then after double thinking — start playing with real funds on MAINNET. It’s all just for fun, so you are responsible for your actions.

3. Let’s stay in touch

WAGMI. Thank you for reading this that far. Soon, we will be posting more information regarding TeFiLuck evolution, don’t miss out!

We will be hosted on: https://tefiluck.games/

Twitter: https://twitter.com/TeFiLuck

GitHub: https://github.com/TeFiLuck

E-mail us: tefiluck.games@gmail.com

All the best, fellow LUNAtic.

--

--

TeFiLuck - fair P2P gambling on Terra

100% open-source, fair P2P gambling services for Terra blockchain ecosystem. We believe in power of smart-contracts. Official site: https://tefiluck.games