Provably Fair

To help ensure the winners of games on BitDraw are chosen randomly, BitDraw uses transparent rules combined with external random data to chose winners. The method is as follows:



Hashing function
Whenever a hashing function is mentioned below SHA-512 is used.


  1. For each game, 2 sources of 512 bits of data are collected/generated: Once at the start of the game, and once at the end.
  2. At the start of a game, the 1st lot of 512 bits of data are pulled from
    • This 512 bits of data is included in a game signature, a hash of which is displayed to the player. This game signature hash allows users to confirm that BitDraw does not change this pre-selected random data.
    • Note: If happens to be unavailable, Ruby's Random.rand function is used, and the result hashed to generate 512 bits.
  3. At the end of a game, the 2nd lot 512 bits of random data are generated by grabbing the id of a tweet on Twitter. The tweet used is the one announcing the finishing of the game in question by @BitDrawLottery.
    • Note: If Twitter happens to be unavailable or returns an error, Ruby's Random.rand function is used.
    • The tweet id value or Ruby's Random.rand value are converted to 512 bits by hashing that value.
  4. Once the game has finished and the 2 lots of 512 bits of data have been collected these are XOR'ed to generate a new 512 bits of data derived from the two 512 bit sources.
  5. This resulting 512 bits is used to determine the winner(s) of the game.
    1. For raffles and lotteries, the mechanics are largely the same. For both types, the 512 bits are used to pick items randomly from the possible choices.
    2. The 512 bits are used as an endless bitstream as follows:
      1. Copy the original 512 bits into a bit array.
      2. If X bits are needed, and there are X+ bits in the current bit array, then X bits are removed and used from the front of the current bit array.
      3. If X bits are needed, but there are not enough bits, a new 512 bit array is created by hashing the entire current 512 bit array.
      4. Go back to b.
    3. For raffles
      1. Pick X bits from the endless bitstream, where X is the number of bits needed to pick an item from the possible tickets for a raffle. For example, if there are 2 tickets, 1 bit, if there are 3 or 4 tickets we need 2 bits, etc.
      2. Check if the X bits converted to a decimal value map to a valid raffle ticket number.
        1. If yes, that is the winning ticket.
        2. If not, got back to a.
    4. For lotteries
      1. Pick X bits from the endless bitstream, where X is the number of bits needed to pick an item from the pool of lottery items. For example, if there are 8 items in the pool 3 bits are needed, if there are 9-16 items 4 bits are needed, etc.
      2. Check if the X bits map to a valid item in the lottery pool and check that item has not already been chosen.
        1. If yes, add that item to the accumulate list of winning lottery items.
        2. If no, go back to a.
      3. If need pick more items, go back to a.
      4. Once all the winning items for the lottery are chosen:
        1. The winning tickets are all tickets for that game matching the winning lottery items.
        2. Split the jackpot evenly between winning tickets.