PancakeSwap lottery is a game built on the Binance Smart Chain that allows users to purchase lottery tickets using CAKE tokens in hopes of winning a large jackpot prize. The lottery mechanics are provably fair and transparent thanks to the blockchain technology that PancakeSwap is built on.
How does PancakeSwap lottery work?
The PancakeSwap lottery works by having users purchase lottery tickets using CAKE tokens. Each lottery ticket goes towards the jackpot prize pool. At the end of each lottery round, the PancakeSwap smart contract randomly selects a winning lottery ticket hash. The wallet that holds the winning lottery ticket is then able to claim the jackpot prize.
Lottery rounds last for 6 hours and there are 4 lottery rounds per day. This means there are new opportunities to win a jackpot prize 4 times per day. The jackpot starts at a minimum of $50 worth of CAKE tokens and can grow into the thousands or even millions of dollars worth of CAKE depending on participation.
Purchasing lottery tickets
To purchase PancakeSwap lottery tickets, users simply need to visit the PancakeSwap lottery page and connect their crypto wallet like Metamask or Trust Wallet. From there, they can choose how many lottery tickets they want to purchase and approve the CAKE transaction.
Each lottery ticket is priced at 10 CAKE. Users can purchase multiple lottery tickets in a single transaction to increase their chances of winning. There is no limit placed on the maximum number of tickets that can be purchased.
Lottery phases
The PancakeSwap lottery consists of the following phases:
- Buy Phase – This is when users can buy lottery tickets for the current round. This lasts for 5 hours and 55 minutes.
- Lock Phase – This is the final 5 minutes of the round where no more tickets can be bought. The random winning ticket hash is also determined during this phase.
- Claim Phase – This is the period after the winning hash has been picked when the winner can claim their prize. This lasts for 6 hours.
After the Claim Phase is over, the lottery resets and a new Buy Phase starts for the next round.
Randomness and transparency
An important aspect of PancakeSwap’s lottery is how it generates random lottery ticket hashes in a provably fair manner. PancakeSwap leverages Chainlink’s Verifiable Random Function (VRF) to provide randomness that users can independently verify.
When the lottery round ends, Chainlink VRF retrieves a random number and hashes it to generate the winning lottery ticket hash. Because this process is decentralized and verifiable on the blockchain, no single party can influence the outcome.
PancakeSwap also makes the lottery mechanics transparent by publishing the smart contract code on the blockchain. This provides guarantees that the lottery is provably fair for all participants.
Lottery ticket probabilities
The odds of winning the PancakeSwap lottery depend on the number of tickets you purchase and the total number of tickets sold for that round. The more tickets you have relative to the total supply, the better your chances are of winning.
For example, if the total number of tickets sold for a round is 100,000 and you buy 1 ticket, your odds of winning are 1 in 100,000. If you buy 500 tickets out of the total 100,000, your odds improve to 500 in 100,000 or 1 in 200.
Buying more tickets stacks the probabilities in your favor but does not guarantee a win. There have also been instances where the jackpot was won with a single lottery ticket purchase.
Probability calculations
We can precisely calculate the probability of winning with x number of tickets purchased as follows:
- T = Total number of lottery tickets sold
- t = Number of tickets you purchased
- P(win) = t / T
For example, if T = 100,000 and t = 5 then:
- P(win) = 5 / 100,000
- P(win) = 0.00005
- P(win) = 0.005% chance
This shows that by purchasing 5 out of 100,000 total tickets, your probability of winning the lottery is 0.005% in this scenario.
Lottery payouts
If you are lucky enough to win the PancakeSwap lottery, you can claim your prize during the 6 hour Claim Phase after the lottery draw.
The jackpot is paid out in CAKE tokens directly to your wallet. CAKE can then be traded on exchanges or staked to earn interest.
The lottery jackpot represents 80% of the total CAKE collected from ticket purchases for that round. Here is how the CAKE from ticket sales gets distributed:
- 80% to lottery jackpot prize
- 10% to next lottery jackpot fund
- 10% burned forever
This means that each lottery round will distribute in prizes 80% of the CAKE raised while collecting tickets. The remaining 20% gets burned or added to the next jackpot to help seed it.
Sample payouts
Here are some sample lottery payouts based on different ticket sale amounts:
Total Tickets Sold | Total CAKE Collected | Jackpot Payout (80%) |
---|---|---|
100,000 | 1,000,000 CAKE | 800,000 CAKE |
1,000,000 | 10,000,000 CAKE | 8,000,000 CAKE |
10,000,000 | 100,000,000 CAKE | 80,000,000 CAKE |
As you can see, the lottery jackpot payout scales in proportion to the total number of CAKE tokens collected from lottery ticket purchases.
Playing the PancakeSwap lottery from a smart contract
The PancakeSwap lottery has an API that enables calling the lottery smart contract functions from an external smart contract.
This allows developers to build interesting applications on top of the PancakeSwap lottery such as:
- Lottery pools where people can team up to combine tickets
- Lottery syndicates with shared winnings
- Recurring lottery subscriptions
Applications like PoolTogether have already used the PancakeSwap lottery API to build decentralized no-loss lotteries.
Lottery API overview
Here are some key functions of the PancakeSwap lottery API:
- buyTickets – Purchase lottery tickets
- claimTickets – Claim any won lottery prizes
- viewLottery – Get details of the current lottery round
- viewNumbers – Get all lottery numbers for a round
- viewUserTickets – Get all a users ticket numbers and statuses
By calling these functions from an external contract, you can build complex lottery interactions and experiences.
Coding lottery contracts
Here is a simple Solidity code snippet for buying PancakeSwap lottery tickets from another smart contract:
pragma solidity 0.6.6;
import "@pancakeswap/pancake-swap-lib/contracts/lottery/PancakeSwapLottery.sol";
contract LotteryBuyer {
PancakeSwapLottery public lottery;
constructor(address _lottery) public {
lottery = PancakeSwapLottery(_lottery);
}
function buyTickets() external {
lottery.buyTickets(10, [1,2,3]);
}
}
This integrates with the PancakeSwap lottery contract to purchase 10 lottery tickets randomly generated based on the input array [1,2,3].
The contract can then call other functions like viewNumbers() and viewUserTickets() to check the ticket numbers purchased and prize statuses.
Profitability of playing the lottery
Given the lottery jackpot represents 80% of the total CAKE collected, this results in a large portion of the amount wagered being paid back out in winnings.
However over time, the 10% burn fee accrues resulting in a slow drain on total CAKE supply. The collective loss from burning also represents collective winnings for CAKE holders.
For the individual lottery player, the transaction fees spent on ticket purchases should also be considered when evaluating profitability.
Simulations
One way to estimate expected profitability is to run lottery simulations. This involves coding a simulation that mimics real world buying and calculates net winnings over many iterations.
Factors like ticket purchases, total number of players, and random distribution of winners can be modeled to gain an understanding of overall profitability.
According to simulations ran by CoinGecko, playing the PancakeSwap lottery with 10 tickets per round resulted in an average ROI of -4.29% over 10,000 iterations. Buying 50 tickets per round resulted in an average ROI of -2.24%.
This suggests that over time, the lotterymechanics drain CAKE away from players resulting in net negative ROI. Large jackpot wins are still possible but not common enough to offset losses.
Mathematical analysis
We can also calculate the expected value mathematically. If we make some simplifying assumptions:
- Jackpot payout is 80% of all CAKE wagered
- You have 1 in 100,000 probability of winning per ticket
- Jackpot size is 100,000 CAKE
Then for 1 lottery ticket purchased:
- Cost = 10 CAKE
- Jackpot = 100,000 CAKE
- P(win) = 1 in 100,000
- Expected Value = (Jackpot * P(win)) – Cost
= (100,000 * 1/100,000) – 10
= 1 CAKE profit
This simplistic analysis suggests a small positive ROI. But in actuality, payouts are lower than jackpot size due to allocation mechanics. When accounting for the 10% burn and rollover, real world ROI turns negative.
Strategies and tips
Here are some strategies and tips that may improve your performance in the PancakeSwap lottery:
Buy more tickets
The more tickets you buy, the better your chances are of matching the winning number. Buying 10 tickets gives you 10x more chances than just buying 1.
Team up with friends
Pooling funds with a group of friends allows you to purchase more tickets and boosts your collective odds of winning.
Use spare CAKE
Consider using spare CAKE or CAKE earned from staking/farming to play the lottery. This reduces downside risk.
Reinvest small wins
If you win a small prize, you may want to reinvest it into buying more tickets in future rounds.
Focus on early rounds
Statistically, early lottery rounds tend to have fewer participants. Your odds can be better in the first few draws after reset.
Write bots / scripts
Automate ticket purchases across multiple wallets and rounds to improve lottery exposure.
Manage bankroll
Don’t risk more than you can afford to lose. Over time, lottery economics lead to slow bankroll drains.
Risks of playing the lottery
While the lottery offers big jackpot prizes, there are also notable risks involved:
Negative ROI long-term
As mentioned earlier, over time the lottery mechanics drain CAKE away from players resulting in expected negative ROI.
Bankroll drain
It’s important to manage your bankroll properly when playing the lottery. Buying too many tickets can quickly result in financial losses.
Smart contract risk
Although PancakeSwap lottery contract is well-audited, there is always risk of contract bugs and exploits.
Addiction
Some players can get addicted to playing the lottery which has detrimental financial impacts.
Opportunity cost
The CAKE used to buy lottery tickets could otherwise be staked or used elsewhere for more profitable opportunities.
How PancakeSwap lottery is different from traditional lotteries
PancakeSwap lottery differs considerably from state-run lotteries in some key aspects:
Better odds
Your odds of winning the jackpot PancakeSwap lottery are typically better than traditional lottery games. Less total players means your tickets make up a larger portion of the probability distribution.
Transparent
The lottery process and mechanics are completely viewable on the blockchain. Things like number of tickets and winner selection are verifiable.
Trustless
Users don’t have to trust anyone. Smart contracts autonomously handle lottery mechanics in a provably fair manner.
No geographic restrictions
Anyone globally with an internet connection can purchase tickets and participate.
Multiple rounds
New lottery rounds start every 6 hours allowing more frequent opportunities vs. once a week drawings.
Crypto payouts
Winnings are paid instantly in CAKE tokens to your wallet rather than wait for checks.
Conclusion
PancakeSwap lottery is an exciting crypto version of traditional lotteries. It offers users provably fair chances to win CAKE jackpots every 6 hours.
Over long time periods, the lottery mechanics result in expected negative ROI for players. But it remains popular due to the small odds of landing a life-changing jackpot win.
When played responsibly and in moderation, PancakeSwap lottery can be an engaging way to potentially earn rewards on your CAKE holdings.