# Burst Lottery AT Live

• im in i sent in 2 transaction of 50 each

• @Gibsalot multiples buy more tickets. i beleive it will count any left over as a donation.

it basically divides the total burst you send by 50 and allocates you tickets based on the result.

so sending 100 burst = 2 tickets

500 burst = 10 tickets

1000 burst = 20 tickets

:)

so far in the pot we have 3'205.9 BURST.

i set the lottery to run for 1 week as it gives most people a good chance to enter.

• @Lexicon Cool. What is the source of randomness used to pick a winner?

• @FlippyCakes sorry i dont understand this question. it uses a random number generator along with the tickets users have bought. each ticket represents a number. i have provided the logic in assembly below if you want to understand it more but it might end up confusing you.

this shows the part that assigns a winner as such

``````UpdateNewPlayerLoop:
^comment new way of grabbing transactions
FUN A_to_Tx_after_Timestamp \$LastTransaction
FUN @ValidTransaction check_A_Is_Zero
BZR \$ValidTransaction :NoMoreTx
FUN @LastTransaction get_Timestamp_for_Tx_in_A

^comment check how much the PlayerPaid and convert to tickets
FUN @NewTickets get_Amount_for_Tx_in_A
ADD @NewTickets \$TicketPrice
DIV @NewTickets \$TicketPrice

^comment run internal lottery based on past tickets
SET @TotalTicketsBought \$TotalTicketsBoughtPreviously
ADD @TotalTicketsBought \$NewTickets

^comment Random Number Generator
SET @MyRandomNumber \$CurrentTime

^comment based on random number, figure out who won.
MOD @MyRandomNumber \$TotalTicketsBought
BGE \$MyRandomNumber \$TotalTicketsBoughtPreviously :ChangeWinner

ChangeWinner:
FUN B_to_Address_of_Tx_in_A
FUN @CurrentWinner get_B1
JMP :UpdateNewPlayerContinue
``````

• @FlippyCakes

Much shorter answer is: It's takes the system time of the block forge and takes the remainder of the division by the number of tickets sold and then sets the winner.

How random is this? Enough would be my answer, we don't know the time that the block will be forged (down to milliseconds) and there is only an estimation on the number of tickets sold so calculating the winner really isn't possible ahead of time.

-IceBurst

• @Lexicon

Awesome work!....as usual.
:-)

@nameless less Give this man a cookie.

• Previously I have looked at setting up an automated lottery in Ethereum, however coming up with a source of randomness is a difficult problem since all numbers need to come from the public ledger without relying on an outside oracle.

In this case, the block timestamp and the number of tickets sold are values that can be influenced (by miners and lottery players, respectively). While unlikely, a clever miner could force a specific winner by providing a crafted timestamp. Or a player could guess at an upcoming timestamp, perhaps by monitoring pools (even more unlikely) and buy X number of tickets to give themselves an edge at being chosen winner.

All unlikely, but something to think about.

• and the winner is BURST-PAQY-8Y72-8MTV-4N39U 4'646.4 burst

congrats :D

• @Lexicon Thanks for your AT development, could you tell how much % of a Lottery goes to issuer in this Lottery case, please. Looks like ~20% ?

As far as i remember, in the org. Lottery AT, all Burst not used for executing AT got paid out.
https://bitcointalk.org/index.php?topic=731923.msg10254497#msg10254497
Lottery AT code used there: http://pastebin.com/xiDdMzEG

• Hi Luxe,

I re-wrote the whole Lottery from scratch. You can see the progress of my research here.

https://github.com/antonyip/BurstAT

You could configure the code to decide how much to have a stake.

• Previously I have looked at setting up an automated lottery in Ethereum, however coming up with a source of randomness is a difficult problem since all numbers need to come from the public ledger without relying on an outside oracle.

In this case, the block timestamp and the number of tickets sold are values that can be influenced (by miners and lottery players, respectively). While unlikely, a clever miner could force a specific winner by providing a crafted timestamp. Or a player could guess at an upcoming timestamp, perhaps by monitoring pools (even more unlikely) and buy X number of tickets to give themselves an edge at being chosen winner.

All unlikely, but something to think about.

I agree that there's no true way to get true randomness.. However, I believe that i can delay the calculation of the picking to the end of the lottery to hide the final winner. This should be able to deter most common users.

• @msgAnton Wow you did awesome work, just overfly it right now ... will take a deeper look later.

• Are you having this run every week or will you announce the next round?

• @msgAnton the randomness seems adequate as you have to send the at 50 burst at the end in order to trigger the end of the lottery. it seemed to pick the 3rd or 4th person to buy a ticket. meaning at the end of the lottery it would of randomly picked a winner.

i wouldn't say a miner could force a time stamp on a block either. if thy had the right deadline but them being able to force this outcome id say is impossible

@luxe it was configured for 20% so that match's up :)

@k-coins we will be testing a continuously running version of the AT and ill announce a new one when its tested.

this is so theirs not like 50+ AT's having to be created for a lottery and rather have 1 AT that resets every week and starts again

ive ran a few and they have accidentally kept all the burst that was sent to them due to a miner bug or misunderstanding at how the entire code runs.

• @Lexicon said in Burst Lottery AT Live:

i wouldn't say a miner could force a time stamp on a block either. if thy had the right deadline but them being able to force this outcome id say is impossible

Seems possible to me, though I'll agree unlikely. As a miner, if I have a few tickets in the lottery and I realize that I'm about to win a block with timestamp 82251394, I know how the tickets are chosen and I know that if I fudge the block timestamp to 82251397 one of my tickets is chosen...

Please correct me if I'm misunderstanding something. I think what you're doing with the lottery is awesome.

Perhaps using the nonce of the block to choose the winner is a better choice, as miners have no control over that number.

• @Lexicon said in Burst Lottery AT Live:

i wouldn't say a miner could force a time stamp on a block either. if thy had the right deadline but them being able to force this outcome id say is impossible

Seems possible to me, though I'll agree unlikely. As a miner, if I have a few tickets in the lottery and I realize that I'm about to win a block with timestamp 82251394, I know how the tickets are chosen and I know that if I fudge the block timestamp to 82251397 one of my tickets is chosen...

Please correct me if I'm misunderstanding something. I think what you're doing with the lottery is awesome.

Perhaps using the nonce of the block to choose the winner is a better choice, as miners have no control over that number.

Well. The main issue is that I'm limited to what i can pull from the API of Burst. Nonce is not exposed and the wallet doesn't know what the nonce is until it is calculated. Also, the AT runs before the nonce is decided so.... cant use the nonce for calculations even if i wanted to. :)

• @msgAnton said in Burst Lottery AT Live:

Well. The main issue is that I'm limited to what i can pull from the API of Burst. Nonce is not exposed and the wallet doesn't know what the nonce is until it is calculated. Also, the AT runs before the nonce is decided so.... cant use the nonce for calculations even if i wanted to. :)

Very interesting. Too bad! By the way, I look forward to diving into your Github repo AT experiments whenever I get some free time.

Just thinking aloud here... would it be possible to do the lottery draw on the block afterwards? So the AT fires at height 100000 but only includes tickets from height 99999 and below, using the nonce from block 99999?

• @msgAnton said in Burst Lottery AT Live:

Well. The main issue is that I'm limited to what i can pull from the API of Burst. Nonce is not exposed and the wallet doesn't know what the nonce is until it is calculated. Also, the AT runs before the nonce is decided so.... cant use the nonce for calculations even if i wanted to. :)

Very interesting. Too bad! By the way, I look forward to diving into your Github repo AT experiments whenever I get some free time.

Just thinking aloud here... would it be possible to do the lottery draw on the block afterwards? So the AT fires at height 100000 but only includes tickets from height 99999 and below, using the nonce from block 99999?

Youre missing alot more infomation such as handling multiple different people buying on the same block and storage of their addresses and stuffs. Also, i don't have the nonce information from the burst api.

Looks like your connection to Burst - Efficient HDD Mining was lost, please wait while we try to reconnect.