BitShares Forum

Other => Graveyard => DAC PLAY => Topic started by: HackFisher on March 31, 2014, 07:24:16 am

Title: Bitshares Play two layers design
Post by: HackFisher on March 31, 2014, 07:24:16 am
Here some ideas to share with you. If you are going to create new DAC based on Bitshares Play, this info might be helpful to you to save your time.

I would like to design play in two abstract layers, the rule layer and the core layer, which will make it very easy to create a alt-play, for play family dac creator.

First, The rule layer is all about the game rule of the play, x of y, or serveral independ color balls with different total and k to select, similar the options in https://bitsharestalk.org/index.php?topic=3818.0

And the play family Dac creators can select whatever kind of rule they like, color counts, ball count, k to select, prize definition. The outer rule layer will also provide simple api for inheritors to customize prizes rules.

Meta data of this rule layer can be described as following json data, inherit DACs could customize it to create alt-play.
{
    version: 1,
    id: 1
    name: "double-color ball lottory",
    rule: {
        balls: [
                {N: 35, k: 5},
                {N: 12, k: 2}
            ],
        prizes: [
                {level: 1, match: [[5, 2]]},
                {level: 2, match: [[5, 1]]},
                {level: 3, match: [[5, 0]]},
                {level: 4, match: [[4, 2]]},
                {level: 5, match: [[4, 1]]},
                {level: 6, match: [[4, 0], [3, 2]]},
                {level: 7, match: [[3, 1], [2, 2]]},
                {leve;: 8, match: [[3, 0], [1, 2], [2, 1], [0, 2]]}
            ]
    }
}

Second, the core layer is nothing but a true random number decentralized raffle process protected by mining, blockchain db etc.
Title: Re: Lotto two layers design
Post by: bitbro on March 31, 2014, 02:39:48 pm
Would this help as foundation for BitShares Lotto family DACs such as BitShares Vegas?


Sent from my iPhone using Tapatalk
Title: Re: Lotto two layers design
Post by: ssjpts on March 31, 2014, 02:58:13 pm
 +5%如果附上中文版的会不会更好?
Title: Re: Lotto two layers design
Post by: HackFisher on March 31, 2014, 03:31:09 pm
+5%如果附上中文版的会不会更好?

因为这里不是中文版,时间也有限,所以没有附上中文。

weibo(chinese twitter) @BTS_Newsroomhttp://weibo.com/u/5059757864 (http://weibo.com/u/5059757864) 有简单精炼的翻译, 如下
Quote
【Lotto】开发者将lotto抽象成两层,规则与核心。规则层将提供简单易用的api供第三方扩展,如果真是按帖子说的那样,就真的是太简单了,自己定义好彩票类型与中奖方式就可以了;核心层则是基于区块链的分布式的随机数抽取过程。http://t.cn/8sMMkQw
Title: Re: Lotto two layers design
Post by: HackFisher on March 31, 2014, 03:40:18 pm
Would this help as foundation for BitShares Lotto family DACs such as BitShares Vegas?


Sent from my iPhone using Tapatalk

Are you mean "Bitshares Vegas" this?
https://bitsharestalk.org/index.php?topic=3621.msg47479#msg47479

This design has not considered the market of data feed in yet, I think it's mainly for lottery and dice category.
Title: Re: Lotto two layers design
Post by: alt on March 31, 2014, 03:52:36 pm

I am wondering why do you want to descripe the rule layer with json file?
I think it's enough to implement it with c++, and it will be more flexible.
Title: Re: Lotto two layers design
Post by: HackFisher on March 31, 2014, 04:01:35 pm

I am wondering why do you want to descripe the rule layer with json file?
I think it's enough to implement it with c++, and it will be more flexible.

Yes, c++ is more flexible, I do experiment to see how easy it can be extended. Data structure is more straightforward, I'll make compromise to use both or just C++ api if  being easy and flexibility can not be acheived them same time.

At present, this json file is just as config file for default Bitshares lotto DAC to release.
Title: Re: Lotto two layers design
Post by: alt on March 31, 2014, 04:06:18 pm

I am wondering why do you want to descripe the rule layer with json file?
I think it's enough to implement it with c++, and it will be more flexible.

Yes, c++ is more flexible, I'm just do experiment to see how easy it can be extended. Data structure is more straightforward, I'll make compromise to use both or just C++ api if  can not be acheived.

At present, this json file is just as config file for default Bitshares lotto DAC to release.
good job, two layers design is good!
Title: Re: Lotto two layers design
Post by: zhangweis on April 02, 2014, 05:12:34 pm
Second, the core layer is nothing but a true random number decentralized raffle process protected by mining, blockchain db etc.

If we need some kind of POW for randomness, why not directly use bitcoin blockchain? The random number can be something like the future nth block's hash. As bitcoin mining involves randomness, it's more secure for a random number generation. The block's hash is difficult to find and it will be difficult for a miner to adjust the hash to his will (to win a lottery) even if he has say 51% power. If we carefully choose the way to use the hash, it can be very difficult (if not impossible) to control the result of lottery.

Maybe we can even chain the blocks by using the hash as another block's index to make it more difficult but I'm not sure whether this will break the randomness.

The down side is that every node (or at least some nodes) needs to download 2 chains to verify the block. But considering the mining power on bitcoin, I think it's worth to directly use bitcoin chain.
Title: Re: Lotto two layers design
Post by: her0 on April 08, 2014, 06:53:48 am
再不搞出来chancecoin都把创意拿走了。