4.23 Workshop: Raffle

This workshop assumes that you have recently completed Workshop: Popularity Contest.

In this workshop, we implement a raffle, where a sponsor starts a timed raffle and a participant class of ticket buyers each buy tickets. This workshop contains two interesting ideas: first, it uses linear state through the Map structure; second, it uses a commitment pattern structure to acquire safe randomness from the set of buyers.

This page is a placeholder for a future more detailed workshop. You could try to implement it yourself though, given the sketch above! If you’d like to see a draft version of our code, please visit examples/raffle in our GitHub repository.