owned this note
owned this note
Published
Linked with GitHub
# Participation Lotteries on Kusama
This document outlines how a configurable, reoccurring lottery system can be used to drive participation on the Kusama network.
## Goal
Participation in Kusama is relatively low.
* Average number of votes per elected council member: 30
* Number of Society members: 5
* Number of votes on current democracy process (Ref 79): 20
Polkascan reports there are [~17,000 active accounts](https://polkascan.io/kusama) on Kusama.
The goal of Participation Lotteries is to stimulate participation on the Kusama network by giving an additional incentive for users to participate.
## User Story
Imagine...
The Kusama network is going to have a very important decision to be made through a democracy proposal. (Maybe a re-denomination...?) The network wants to stimulate participation of this vote by the end users, so it creates a new lottery.
Council, or some other origin with access will start a new lottery using the "vote" extrinsic. This lottery will be initialized with some funds from treasury to start the pot. Let's say 50 KSM
Users who want to opt into this lottery can do so by calling the `vote` extrinsic wrapped in a `buy_ticket` extrinsic. (Think like how we wrap calls for `sudo`).
By calling the `buy_ticket` extrinsic and wrapping the underlying call, the user purchases a 1 KSM ticket into the lottery, and the lottery pot increases by 1 KSM.
Users who are not interested in the lottery can simply choose to call `vote` directly. Nothing here is changed.
Users will continue to participate in the lottery until the lottery period is completed. (This lottery period will likely be tied to the event at hand, for example the time until the vote expires, the end of an Era/Epoch, etc...)
Once the lottery period is over, a random user among those participating will be selected and win the entirety of the pot.
Details below.
## Game Theory
As with any game on the blockchain, there needs to be reasonable incentives and disincentives for users to behave the way we want.
### Incentives
The lottery is seeded by some funds from the treasury. As a result, any participant entering the lottery would have positive expected value (EV).
We can use the `seed` amount to control participation. The higher the seed, the larger the EV for a larger number of participants.
In general, it would seem that humans love to participate in lotteries. The chance to win a lot of money at little cost triggers something that may not always make economically sound decisions.
It is possible that this lottery system incentivizes "mindless" participation by users not interested in the underlying call, but just interested in participating in the lottery. AFAIK, this is unavoidable in any participation incentive mechanism. However, I think that on average, the network will benefit from more participation as a whole.
### Disincentives
One potential issue with lotteries on the blockchain is that it is somewhat vulnerable to Sybil attacks. i.e. given that participating is positive EV, a user could create many many entries into the lottery to have a high chance of winning.
However, this can also be limited and controlled through fees and the `seed` amount. In order for a user to successfully complete such an attack, they would need to transfer at least the ticket price amount of tokens to N accounts. Then each of the N accounts need to submit a wrapped extrinsic for the underlying call to be made, which involves its own transaction fee on top of the ticket price.
That means that such an attack would cost `N * (transfer_fee + account_creation_fee + call_fee)` tokens. If the treasury seed is below this amount, the user is no longer incentivized to participate. Furthermore, margins would be slim for such a user, and continue to worsen as more users join.
### Other Important Points
To complete a lottery, we need to be able to randomly select a winner. Substrate/Kusama provides on chain randomness that is used for other parts of the network. It may be at certain absurd lottery pots, that block producers may be incetivized to hold back blocks which they are not the winner of the lottery, or some other negative incentives... Would potentially need feedback from W3F research team who knows more about the limits of using this randomness.
It would of course not be controllable directly by a user.
## Network Effects
A participation lottery can be used to drive forward the following behavioral changes to the network by attaching a lottery to a specific extrinsic:
* Have more users share their voice on important elections. (`vote`)
* Have users change/update their validator nominations on a regular schedule. (`nominate`)
* Have more users join Society or other similar social experiments (`put_bid`)
* Encourage brainstorming of ideas in future updates and changes (`propose_bounty`)
* Have more users (change their) backing of (candidate) council members (`electionPhragmen`,`vote`)
* etc...
## How
This section describes how a Participation Lottery may be implemented. Some details of the implementation are "known" and some things are "flexible"/"unknown".
### Known
* A new pallet will be created which manages these auctions.
* The pallet will be configurable to allow any call(s) in the runtime to be the source of buying a ticket.
* A configurable `seed` amount will be allocated from a funding source (like treasury) to kick off lotteries.
* Users will pay a configurable `ticket_price` to participate in lottery, this will be placed in the pool.
* Winners will be determined at some non-user-controllable future block, and use the on-chain randomness to pick a winner.
* More to be added...
### Flexible
* Lotteries can be regularly scheduled or initiated explicitly each time by governance.
* Multiple extrinsics can be whitelisted at once for one lottery.
* Participation can be limited 1 per lottery or 1 per extrinsic per lottery.
* Could have more than one lottery winner, maybe with lesser prize payouts.
* Previous lottery can be used to seed next lottery.
* More to be added....
## Delivery
Initial estimates predict that this end to end development should take 5 full days (spread over 2 - 3 weekends). For that work, a suggested budget of 250 KSM should be allocated.
To deliver this feature the following tasks need to be completed (with suggested delivery cost):
* [ ] Create the basic pallet structure/idea. (100 KSM)
* [ ] Refine pallet based on feedback and discovered limitations. (50 KSM)
* [ ] Write comprehensive tests ensuring safety of the pallet. (50 KSM)
* [ ] Benchmark and weigh the pallet for production use. (50 KSM)
* [ ] Have the pallet reviewed and merged by Parity development team.
It is possible that delivery may be delayed slightly based on unforeseen factors, but that should be made clear at milestone 2 where we need to refine the pallet based on feedback.
## Questions
Feel free to add questions to this document below:
- [x] This seems like a project with similar complexity as the Bounty project. If this project is going to proposed as a Bounty, the council should get a ball-park figure to Budget this expense. I feel we need to evaluate actual cost/expenses (time spent * rate) of the Bounty project to allow proper budgetting of this project. (by Emiel)
> I would propose an initial budget of 250 KSM for approximately 5 days of work (~2 weekends), and any additional budget can come from donations if people are satisfied with my work and my timeliness.
- [ ] Make a question like this.
> I will answer like this.
## Multi-winner algorithm
Extra section by Jeff Burdges. Please move to where appropriate.
We wait enough BABE or Sassafras epochs so that the epochal randomness from BABE or Sassafras becomes fresh, which takes an extra epoch or so under Sassafras. As $\textsf{vrf_output}$ iterate over the VRF output of the first $n$ slots of this fresh epoch, or maybe primary slots in BABE's case, we award one share of the pot to each voter identenfied by
$$ H(\textsf{vrf_output} || \textsf{lottery_id}) \mod \textsf{num_voters} $$
These winnings would not be dust if $n$ is small enough.
We have security arguments for BABE/Praos and soon Sassafras in which one proves that one honest (primary) block producers per epoch makes the epoch randomness unbiasable enough that the next epoch has (many) honest block producers. Yet, these results say little about the actual bias levels:
- Epochal randomness remains quite biasable due to block producers choosing their ancestors both before and after epoch ending. Also adversaries could bias previous epochal randomness, with perhaps slightly more than one bit of influence per slot, so that they control many block production slots around the epoch boundary. We use epocal randomness irectly in parachain auctions because the winnings are high stakes but this remains imperfect and benefits from a VDF (see https://github.com/w3f/research-internal/issues/50).
- Individual block VRF outputs remain biasable by block producers notcreating their blocks, which consts them rewards. If $n$ is large enough then the winnings adjustment is less than block rewards, and nobody would not make a block so that their own winning voters capture more of the rewards.
### Layman
* jeff
In short, you fix a bunch of future slots that determine the multiple winners, adding more or less slots so that each winners winnings are neither dust nor higher than the block reward, and then you let the BABE VRF for primary slots or non-ring VRF in Sassafras determine winners.
As you say, these lotteries are not on the scale that validators would do malicious things, but this guideline can actually be enforced with multiple winners.
of course maybe the game is less fun if the winnings are less than block rewards. :)
* shawntabrizi
so:
1. start lottery
2. collect funds until end
3. divide total funds by block reward amount to get N sized winnings each of size block reward (or slightly less, whatever)
4. at the start of a new validator set, pick one winner per block until all funds are distributed
* jeff
yes
I have not figured out if one should only use primary slots in babe or not. I guess only primary, whic means a factor of like 4 in there
* shawntabrizi
primary slots you mean that if the main block producer doesnt make a block, but the secondary block producer does, we should not pick a winner
* jeff
yes