How does this work?
Welcome to the Pirate Lottery!
Pirate Lottery is a decentralized lottery that runs completely on the Ethereum blockchain. The entire operation of the lottery is controlled by an Ethereum smart contract - with no backend server whatsoever. The user interface for the Pirate Lottery runs completely within your browser. The user interface is hosted via IPFS (the InterPlanetary File System). This means that no person can modify the way that the lottery works, and now that it is published, it cannot be changed.
The Prize The total proceeds of all the ticket sales from each round of a lottery is awarded to the winner of that round, minus a two percent fee that goes to the PLP Token holders. Compare this to the 40% or more that is normally taken from government-run lotteries!
How the Lottery Works: There are two lotteries: "Pirate's Booty" and "Buried Treasure". Generally tickets for the "Pirate's Booty" lottery are cheaper than tickets for the "Buried Treasure" lottery, but otherwise the two lotteries function in the same manner.
During each round of a lottery people can purchase tickets for the posted ticket price, as long as the round is open. Once the maximum number of tickets have been purchased the round is closed. If the round has been open longer than its maximum duration (5 days), then regardless of the number of tickets sold, the next ticket purchased closes the round.
After a lottery round is closed the winner of the previous round can claim their prize. The winner of the previous round will get a notification like this:
And can claim their prize by clicking on the claim prize button, which will look like this:
After the prize of the previous round is claimed, the winner of the current round is selected (read below for technical details regarding how the winner is selected fairly). And once the winner is selected, the next round of the lottery is opened. The duration timer starts when the first ticket of the new round is purchased.
Price Adjustments: Before each new round begins both the ticket price, and the maximum number of tickets available are determined, based on how long it took to complete the previous round. If it took a long time then the ticket price is adjusted downwards (within bounds), and the maximum number of tickets is likewise adjusted downwards. Similarly if the previous round sold out very quickly, the ticket price is adjusted upwards, and the maximum number of tickets is increased.
Abandoned Prizes If the winner of a round does not claim his prize within five days after the closing of the round, then the prize is considered "abandoned." An abandoned prize can be claimed by anyone who participated in the round. When an abandoned prize is claimed, it only pays 50% of the lottery proceeds. If it's possible to claim an abandoned prize then a notification will appear, as shown below:
Profit Sharing With Pirate Lottery Profit (PLP) Tokens The payout to the winner of each lottery round is equal to 98% of the revenue from ticket sales. The other 2% is profit, which goes to the holders of PLP Tokens. Two thirds of the PLP Tokens will be distributed to the early users of the lottery. The way this works is that two thirds of the PLP Tokens are held in the PLP Reserve. The lottery contract awards one PLP Point for every lottery ticket you purchase. You can redeem the PLP Points that you accumulate for PLP Tokens from the PLP Reserve (1 token per point until the PLP Reserve runs out of tokens). To see the number of PLP Points that you've accumlated; and to redeem your PLP Points for PLP Tokens; and to withdraw your PLP dividends, just click on the treasure-chest icon:
Technical Challenges: One of the challenges in creating a lottery program that runs on the Ethereum blockchain is that Ethereum has no native random-number-generator. The basic reason for this is that no matter what algorithm is used to generate a random number, the algorithm can be run before the next Ethereum block is mined, and thus the number can be known ahead-of-time.
Other games-of-chance that run on the Ethereum blockchain either use an outside source for random numbers (an oracle), or they use something that could actually be known to a hacker ahead-of-time (such as the block hash of the previously mined block).
In order to get around the random number challenge, Pirate Lottery uses information that is completely on-chain, but A) not known while a round is open and B) not change-able after a round is closed:
A hash, called the "player-hash" is created from the addresses of all the ticket purchasers. the final input to the hash is the hash of the miner who mines the Ethereum block that closes the round. Thus this hash cannot be known to any ticket purchaser while the round is open. Finally, in order to claim his prize, the winner of the previous round needs to sign a message that contains the player-hash of the current (closed) round. This signature is the final puzzle piece that goes into the selection of a "random" winner of the current round.
Note that no player purchasing tickets for a given round has sufficient data to compute the player-hash, because the player-hash includes the address of the miner who mines the block that closes the round. Also the miner who mines the block cannot know or meaningfully impact the selection of the winner of the current round, because he does not know the signature of the winner of the previous round.
Anyone can examine the source code for the Pirate Lottery to verify that the winner-selection algorithm is completely fair, and cannot be manipulated by any party!
Pirate Lottery Profits!
Whether you win or lose, you get one Pirate Lottery Profit (PLP) point for every lottery ticket you purchase. You can redeem your PLP points for PLP Tokens (1 token per point).
PLP Tokens receive dividends from every lottery round, whether you participate or not!
Minimum redemption amount: 10 points