# CIP Draft - Instant Lottery

**URL:** <https://forums.counterparty.io/t/cip-draft-instant-lottery/3020>\
**Category:** Counterparty\
**Created:** [May 22, 2017, 8:16am UTC](https://forums.counterparty.io/t/cip-draft-instant-lottery/3020 "2017-05-22T08:16:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![JPJA](https://yyz2.discourse-cdn.com/flex004/user_avatar/forums.counterparty.io/jpja/32/1324_2.png) [@JPJA](https://forums.counterparty.io/u/JPJA)\
**Post date:** [May 22, 2017, 8:50am UTC](https://forums.counterparty.io/t/cip-draft-instant-lottery/3020/2 "2017-05-22T08:50:43Z")

</div>

Reserving first reply for answering frequent questions and justifying details surrounding the CIP.

* * *

**Not in this CIP but would be nice …**

- Cheaper, more efficient [transaction encoding](https://forums.counterparty.io/t/idea-bet-encoded-in-op-return/3043)
- Support for betting with assets, not just XCP
- Bets on [less/not-less](https://forums.counterparty.io/t/betting-equal-notequal-vs-less-notless/3062/2) (would enable any probability to be played on)
- Oracle feed a uniform random value 0-1
- More frequent oracle feed (maybe every block) - useful for [VM contracts](https://forums.counterparty.io/t/proof-of-concept-vm-development/3031/3)

* * *

**Magic Numbers Should be Debated**

- I chose probabilities 1/2, 1/4, 1/8, etc since they are mathematically “beautiful” but any other set can be chosen as long as they sum to 1. E.g. the following set; `1/2, 1/6, 1/8, 1/10, 1/16, 1/36, 1/100, 1/1000, 1/141.73228` can simulate dice roll, double dice roll, coin flip, triple coin flip, quadruple coin flip and some round number lotteries. The 1/141.73228 case is needed so they sum to 1. Note that when the protocol updates to less/not less (after maybe the next CIP) then the oracle can broadcast a uniform decimal 0-1 and _all_ probabilities can be played on.

- Similarly, which probabilities should the auto player bet against? I chose the highest to be 1/4. At this probability a miner attack is more expensive than at 1/2, although at 1/2 it is prohibitively expensive anyway. Then it plays on every set up to 1/128 to give wide range of odds and payoffs, and finally 1/1028 just to have one lottery with very high potential payout. Any higher is not practical.

- A game every 24 blocks (~4 hours) is often enough for there always to be an active game, yet gives enough time for tx to confirm. It’s also set this rare to reduce DB growth. However, it may be worth broadcasting a random number for every block once the VM goes live. It can be used for other contracts too.

- The fee is set at 0.05%. This means that any game, even those with human-human (it’s not necessary to play against the bot) will have some friction. I chose this partially to make people accustomed to the concept of a fee (more support for raising it later if needed) and partially to prevent miner attack. If the fee were higher it would prohibit games with low probability.

- The bot plays with half its balance. A higher proportion would give more XCP to play against but would also reduce the XCP amount more whenever the bot loses.

- 99% expected payout for the player is probably the best in the world! Why not? A slight margin is enough to make the bot’s XCP balance grow.

* * *

**Understanding the Auto Bet Bot**

Initially someone needs to transfer some XCP to the bot address - 1CounterbetXXXXXXXXXXXXXXXXXWhGbTM.

I can do this myself. I’ll transfer a few XCP and start playing. Since it has a small edge, it will accumulate XCP over time.

The bot always takes the side with a large wager relative to the counterwager. E.g. on the 1028x bet, if it wagers 100 XCP, the human on the other side only needs to bet roughly 0.1 XCP.

This will, in the beginning before the bot accumulates more XCP, lead to a shortage of XCP at play. Humans at the other side may be left with unmatched bets that expire.

However, humans can also bet on the same side as the bot; even offer slightly better odds. This is a good thing, as the bot’s role is just to stimulate / kickstart a market. The more humans who play, the more infrastructure that will be deployed.

---

_[View the full topic](https://forums.counterparty.io/t/cip-draft-instant-lottery/3020)._
