Post
Topic
Board Announcements (Altcoins)
Re: [ANN][ICO] Fire Lotto - International blockchain LOTTERY
by
Tommy Cash
on 01/03/2018, 16:06:03 UTC
FireLotto is 100% decentralized platform piwered by smart contracts only. You can check bitcoin hash for each draw in draw history on firelotto.com All as mentioned on whitepaper.
"piwered by smart contracts only" - really? please show us how Ethereum smart contract is contacting Bitcoin blockchain to calculate random number (random number generator / RNG)Huh

Can you, please? Smiley

RNG ALGORITHM

Step 1: During a drawing, the 1st is taken after the time current publicly hash code of a bitcoin block is taken from blockchain.info. For example:
000000000000000000229a9deacb0ed81b54afb92581e9b5b2e25dbd3a8069a2

Step 2: An array of all the numbers that can be drawn is built. For example, an array for the 6/45 lottery will consist of 45 elements from 1 to 45 inclusive.

Step 3: The last n bytes are taken from the bitcoin hash, where n is the number of balls drawn. For example, n = 6 for the 6/45 lottery.

Step 4: Each byte received goes through the modulo operation and is divided by the remaining number of elements in the array of all available numbers. The remainder serves as an index of the number that has been drawn from the array of all available numbers. The number that has been drawn is transferred to a separate array of numbers drawn and is deleted from the array of all available numbers.

Step 5: This iteration is repeated n times in order to get all n numbers drawn.

An optimized code for a smart contract is shown below.

function getWinNumbers(string randomStr, uint numberCount, uint
numberCountMax) constant public returns (bytes){
 bytes32 random = keccak256(randomStr);
 bytes memory allNumbers = new bytes(numbersCountMax);
 bytes memory winNumbers = new bytes(numbersCount);
 for (uint i = 0; i < numbersCountMax; i++) {
 allNumbers = byte(i + 1);
 }
 for (i = 0; i < numbersCount; i++) {
 uint n = numbersCountMax - i;
 uint r = uint(random[random.length - 1 - i]) % n;
 winNumbers = allNumbers[r];
 allNumbers[r] = allNumbers[n - 1];
 }
 return winNumbers;
}