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;
break;
}
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
console.log(lotteryWinner)
}
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
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:
fefecd9af7372c978fdbf459b015df49c893bbe036b82c207b936d960da2d37b
The lottery result will be posted in this thread as soon as possible.