bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 25, 2011, 12:12:33 PM Last edit: June 05, 2011, 07:50:50 AM by bitcoinlottery |
|
What is the Bitcoin Lottery?
The Bitcoin Lottery is a lottery where anyone can win, the lottery takes no share and the process is transparent. The code that picks the winner(s) is open source. How does it work?You can send an arbitrary amount of bitcoins (minimum 0.01 bitcoin) to an adress. The adress for next lottery (closes July 1) is: 1LUeahDNnVwqh8utERNxPhoh7zdzSmh4AG
(view: http://blockexplorer.com/address/1LUeahDNnVwqh8utERNxPhoh7zdzSmh4AG) When do I win and how much?All bets are randomly assigned to a block. Each block is equal to the average deposit. The program picks randomly a block and returns the winners and their share (in percent). For example, if you send 0.1 bitcoin and the average is 1 bitcoin, you probably end up in one block and then you win 10% of the draw. If you send 1 bitcoin and the average is 1 bitcoin, you probably end up in two blocks randomly, for example 10 cents in one block and 90 cents in another. If you win with the first block you win 10%, the second block will return 90% of the draw. So to be sure to have the chance of winning 100% you need 2 bitcoins. The program is designed in such a way the lottery will always return 100% of the jackpot size. Don't you cheat?No. The first and second block on 1 July (after 0:00 UTC) will be used as random strings by adding them and create a SHA256 hash. The code (Python)
import math tickets = [ ["1Km4sASEeKUWPtjRaSxmVghF5FfkadWVei",2], ["18uZGH42pcmHVtZ8sux7bCf8oJJtSCAAJs",1], ["1Jmn97kfJ6DBBCuft6Z1oW8e2Lwgheyr6s",2], ["1Jmn97kfJ6DBBCuft6Z1oW8e2Lwgheyr6s",1], ["1Jmn97kfJ6DBBCuft6Z1oW8e2Lwgheyr6s",1], ]
class BitcoinLottery: def __init__(self): self.total = 0 for x in tickets: self.total += x[1] self.BLOCKSIZE = int(math.ceil(self.total/float(len(tickets))))
def shuffle(self, rand): i = 0 prevx = 0 for t in range(len(tickets)): j=0 shuffle=0 for x in range(t, len(rand)): j = j + ord(rand[x]) shuffle = j % len(tickets) - i tickets[i], tickets[i+shuffle] = tickets[i+shuffle], tickets[i] if (i < len(rand)-1): i+=1 else: i=0 def calculate(self): blocks = [] block=0 for x in tickets: k = x[0] v = x[1] nblock=block while(v>0): r = self.BLOCKSIZE - block % self.BLOCKSIZE if (v <= r): a = v nblock+=v v = 0 else: a = r v -= r nblock += r blocks.append([int(block/self.BLOCKSIZE),k,a]) block = nblock rand = 0 print("total: " + str(float(self.total)/100) + " bitcoins") for x in blocks: if (x[0] == rand): print(x[1] + " won " + str(float(x[2]*self.total)/10000 * (100/self.BLOCKSIZE)) + " bitcoins") bit = BitcoinLottery() bit.shuffle('3029309209i1'); bit.calculate()
|
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 25, 2011, 12:36:47 PM |
|
Note: this lottery is just for fun, I don't want to earn any money with it.
|
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 25, 2011, 10:39:35 PM |
|
The first 6 participants will get 0.02 bitcoin. So when you enter with 0.01 bitcoin you earn 0.01 and can also win the lottery!
|
|
|
|
Jfqs6m
Newbie
Offline
Activity: 25
Merit: 0
|
|
May 25, 2011, 11:28:36 PM |
|
Eh I guess it's worth a shot. Something to spend my free bitcoins I got on.
|
|
|
|
E
|
|
May 26, 2011, 12:37:01 AM |
|
Sent.
|
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 04:08:07 AM Last edit: May 26, 2011, 04:22:13 AM by bitcoinlottery |
|
I sent you the 0.02 coin!
|
|
|
|
Jfqs6m
Newbie
Offline
Activity: 25
Merit: 0
|
|
May 26, 2011, 04:17:45 AM |
|
I sent you the 0.02 cents!
Thank you very much!
|
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 04:32:36 AM |
|
Jackpot: 0.07, two days to go! If the total jackpot is not more than a bitcoin I am inclined to reduce the size of the blocks (to not give everyone his deposit back, but get one or a few winners). I am thinking about what size would be the best? The average deposit? Input welcome!
|
|
|
|
bitlotto
|
|
May 26, 2011, 04:34:26 AM |
|
I think I get what your doing... I think. I'm pretty tired and I don't know python so I'll have to look later. I get that your trying to be open but even though people can see the code there is no way really for the users to know you are actually running it. Someone could just -say- they are going to run that code. Enter a few of their own entries. Tell the users that they ran the code but instead just pay themselves and make up results that fit. (I'm not saying you are doing this but for people to bet lot's of money they need CERTAINTY you can't cheat. I've seen a few lottery scams but I am willing to help you make it so that you can't cheat...) Anyways, good luck!
|
*Next Draw Feb 1* BitLotto: monthly raffle (0.25 BTC per ticket) Completely transparent and impossible to manipulate who wins. TOR TOR2WEB Donations to: 1JQdiQsjhV2uJ4Y8HFtdqteJsZhv835a8J are appreciated.
|
|
|
Jfqs6m
Newbie
Offline
Activity: 25
Merit: 0
|
|
May 26, 2011, 04:36:44 AM |
|
I think I get what your doing... I think. I'm pretty tired and I don't know python so I'll have to look later. I get that your trying to be open but even though people can see the code there is no way really for the users to know you are actually running it. Someone could just -say- they are going to run that code. Enter a few of their own entries. Tell the users that they ran the code but instead just pay themselves and make up results that fit. (I'm not saying you are doing this but for people to bet lot's of money they need CERTAINTY you can't cheat. I've seen a few lottery scams but I am willing to help you make it so that you can't cheat...) Anyways, good luck!
Eh I guess it's still a possibility but he did indeed send me my .02 BTC for being one of the first 6....
|
|
|
|
bitlotto
|
|
May 26, 2011, 04:40:45 AM |
|
I think I get what your doing... I think. I'm pretty tired and I don't know python so I'll have to look later. I get that your trying to be open but even though people can see the code there is no way really for the users to know you are actually running it. Someone could just -say- they are going to run that code. Enter a few of their own entries. Tell the users that they ran the code but instead just pay themselves and make up results that fit. (I'm not saying you are doing this but for people to bet lot's of money they need CERTAINTY you can't cheat. I've seen a few lottery scams but I am willing to help you make it so that you can't cheat...) Anyways, good luck!
Eh I guess it's still a possibility but he did indeed send me my .02 BTC for being one of the first 6.... I know. I'm not saying he is a scammer but he could change a few things to eliminate a very easy way to fake results.
|
*Next Draw Feb 1* BitLotto: monthly raffle (0.25 BTC per ticket) Completely transparent and impossible to manipulate who wins. TOR TOR2WEB Donations to: 1JQdiQsjhV2uJ4Y8HFtdqteJsZhv835a8J are appreciated.
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 04:47:50 AM |
|
I think I get what your doing... I think. I'm pretty tired and I don't know python so I'll have to look later. I get that your trying to be open but even though people can see the code there is no way really for the users to know you are actually running it. Someone could just -say- they are going to run that code. Enter a few of their own entries. Tell the users that they ran the code but instead just pay themselves and make up results that fit. (I'm not saying you are doing this but for people to bet lot's of money they need CERTAINTY you can't cheat. I've seen a few lottery scams but I am willing to help you make it so that you can't cheat...) Anyways, good luck!
Yes, but I apply the same method as you do: people can see what comes in and out. So people can see it is paid to one / a few that participated=).
|
|
|
|
bitlotto
|
|
May 26, 2011, 04:56:03 AM |
|
Yes, but I apply the same method as you do: people can see what comes in and out. So people can see it is paid to one / a few that participated=).
Yes, you are right in that you show the winnings move around BUT unlike yours *I have NO control* over picking the winner. I can not fake the random numbers. That was what I was getting at. Yes, you show that you are paying. BUT, the results themselves can not be verified in yours. The key is getting some type of list of entrants, publish it, THEN have the winners come from random numbers that you CAN NOT manipulate but still everyone can get those random numbers. If you want help coming up with something I'm willing to help...
|
*Next Draw Feb 1* BitLotto: monthly raffle (0.25 BTC per ticket) Completely transparent and impossible to manipulate who wins. TOR TOR2WEB Donations to: 1JQdiQsjhV2uJ4Y8HFtdqteJsZhv835a8J are appreciated.
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 05:06:12 AM |
|
Okay, great point! If the jackpot contains more than a few bitcoins I will surely look at what I can do. Your method is very nice by the way!
|
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 05:14:40 AM |
|
Do you know whether the transaction hashes are totally random/uncontrollable? If so, the hashes can be added up and used for the random generator as quite easy alternative.
|
|
|
|
eskil
Newbie
Offline
Activity: 23
Merit: 0
|
|
May 26, 2011, 06:17:53 AM |
|
I would like to join aswell, but I am new to bitcoin and only got 0.02 bc and it wont let me send 0.01 Always says something about transaction fee because the amount is too large!?
|
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 01:25:13 PM |
|
I would like to join aswell, but I am new to bitcoin and only got 0.02 bc and it wont let me send 0.01 Always says something about transaction fee because the amount is too large!? The current client asks 0.01 btc if you send small amounts. That amount is far larger in the development code. Strange that it won't let you send 0.01 if you have 0.02... Maybe try to get some other cents (mining, trading, etc)?
|
|
|
|
bitlotto
|
|
May 26, 2011, 01:26:06 PM |
|
Do you know whether the transaction hashes are totally random/uncontrollable? If so, the hashes can be added up and used for the random generator as quite easy alternative.
They are fairly random. BUT the RANDOM number for the winner has to come after all the tickets, for IF the user knows what transaction hash will win they could re-send over and over until they get a hash that wins. For mine, I wait till the tickets are in then set up finding who won.
|
*Next Draw Feb 1* BitLotto: monthly raffle (0.25 BTC per ticket) Completely transparent and impossible to manipulate who wins. TOR TOR2WEB Donations to: 1JQdiQsjhV2uJ4Y8HFtdqteJsZhv835a8J are appreciated.
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 01:30:20 PM |
|
Do you know whether the transaction hashes are totally random/uncontrollable? If so, the hashes can be added up and used for the random generator as quite easy alternative.
They are fairly random. BUT the RANDOM number for the winner has to come after all the tickets, for IF the user knows what transaction hash will win they could re-send over and over until they get a hash that wins. For mine, I wait till the tickets are in then set up finding who won. Yes I thought about that later. So basically secure hash the (big) random value and distribute the hash?
|
|
|
|
bitcoinlottery (OP)
Newbie
Offline
Activity: 28
Merit: 0
|
|
May 26, 2011, 01:31:23 PM |
|
The algorithm changed by the way. The block size is now the average deposit.
|
|
|
|
|