- roll the dice and win 2000 REAL CKB!

Hi Nervos community!

This is Ben from

CkbDice is a dice game based on CKB. Everyone is welcome to play (with testnet CKB) and win some real CKB. We offer a 2000-real-CKB prize for those 10 lucky addresses by the end of the current testnet.

Please remember this is our first edition and we are still adding features like provably fairness, off-chain bet, etc.

Feel free to ask questions or comment here.

Have fun and good luck!


So where does the randomness come from?

for now it is a RNG on the backend server, which is centralized and fairness-unprovable. :smile:
We will offer provable fairness as soon as possible.

The Lottery Draw for the final top-10 winners

First, we want to thank all the players for placing bets on our very first version of CkbDice. We hope you have had some fun.

In this post we will explain how and when we will make a provably-fair lottery draw for our final top-10 winners.

Let’s take a look at the the final leaderboad (top-10):

Place Address Winning Ticket Start No. Ticket End No.
1 ckt1qyq259pusejtrjkjf7v2h2m6tmycrn3sl76qhsvydh 891 0 891
2 ckt1qyqq8r7dgtfqfhhkhf5qu9au7h2gnl4e7kvshafrqj 792 892 1683
3 ckt1qyq83rvy795fm3f5lksng2awfh2dktdndsnqzvs6u8 594 1684 2277
4 ckt1qyqg6fw9nhyqzrw8zzlxdk69e3fryp22zscsrdrg63 558.36 2278 2835
5 ckt1qyqdnsyx5ttj6qx6a2x57nu35yanp8t02meqfp45r8 495 2836 3330
6 ckt1qyqpk0apd93llee89ldxn7fv4xzyrzqwskwsczc0xx 396 3331 3726
7 ckt1qyqfj7mrcyvgfsdjjwzwavpn64snjpe0luyqk0m8n9 373 3727 4099
8 ckt1qyq9fhzxn58qqqewzhejnyedu47xsz030pnqa483n5 316.8 4100 4416
9 ckt1qyqp28mngunw7u3n0vvjl88djnmyl64m9hzqlvrsqx 306.9 4417 4723
10 ckt1qyqfam7emdk9n2cjlt6xk88de4suf5dvqmhslxe0al 306.9 4724 5030

To make the lottery draw process easier to understand, we grant the top 10 addresses some lottery tickets corresponding to their winning:

And here are the lottery draw code which is written in Javascript.

var blockHashArray = []
//hash of block 1201 - block 1210

var ckbDiceSeed = ?
//we will reveal it after the draw is finalized
//the SHA-256 hash of ckbDiceSeed: fefecd9af7372c978fdbf459b015df49c893bbe036b82c207b936d960da2d37b

for (let index = 0; index < blockHashArray.length; index++) {
    const blockHash = blockHashArray[index];
    const crypto = require('crypto');
    const hash = crypto.createHmac('sha512', ckbDiceSeed).update(blockHash).digest('hex');
    const hashLength = hash.length;
    const step = 5;
    let start = 0;
    let randomNumber;

    do {
        const end = start + step;

        if (end > hashLength) {
            randomNumber = 9999;

        randomNumber = parseInt(hash.substring(start, end), 16);

        start += step;
    } while (randomNumber >= 1e6);

    randomNumber /= 1e6;

    const lotteryWinner = Math.round(5030 * randomNumber)
    //5030 is the total number of lottery tickets


blockHashArray stores the hash of block 1201 - block 1210, which will only be known about 30 minutes after this post is submitted.

ckbDiceSeed is a seed we create to avoid someone rig the block hash to benefit themselves, which is extremely unlikely to happen :grin: but still technically possible. The seed will be revealed after the draw process is finalized and for now we provide you the SHA-256 hash of our seed:


The lottery result will be posted in this thread as soon as possible.

The Final Prize

ckbDiceSeed revealed:

CkbDice’s first testnet contest.

Draw No. Ticket Number Winner
1 352 ckt1qyq259pusejtrjkjf7v2h2m6tmycrn3sl76qhsvydh
2 2230 ckt1qyq83rvy795fm3f5lksng2awfh2dktdndsnqzvs6u8
3 858 ckt1qyq259pusejtrjkjf7v2h2m6tmycrn3sl76qhsvydh
4 1185 ckt1qyqq8r7dgtfqfhhkhf5qu9au7h2gnl4e7kvshafrqj
5 2565 ckt1qyqg6fw9nhyqzrw8zzlxdk69e3fryp22zscsrdrg63
6 1310 ckt1qyqq8r7dgtfqfhhkhf5qu9au7h2gnl4e7kvshafrqj
7 3652 ckt1qyqpk0apd93llee89ldxn7fv4xzyrzqwskwsczc0xx
8 4686 ckt1qyqp28mngunw7u3n0vvjl88djnmyl64m9hzqlvrsqx
9 224 ckt1qyq259pusejtrjkjf7v2h2m6tmycrn3sl76qhsvydh
10 4734 ckt1qyqfam7emdk9n2cjlt6xk88de4suf5dvqmhslxe0al


Prize will be sent in one hour.

Prize tx

Hey I sent a TX to the contract and nothing happened, blockchain recorded, never showed if it wa a winner or loser, I’d like a refund, thanks.


look at timestamp and check your system. Something went wrong. Never had this problem before.

Sorry Jlomba! There happened to be a glitch on the back-end and now it’s fixed.

Thank you for playing CkbDice.