Running a 50/50 Raffle for a School or other Nonprofit

I’ve created sites for clients that accept donations and it’s fine but I would love to be able to have a simple Marlowe contract that constantly runs an on-the-fly 50/50 raffle. Here’s the idea:
School has 2 accounts - “Escro Account” for receiving ADA for the 50/50 and “Profit Account” that the proceeds are pushed to after a winner is chosen.

User sends X ADA to escro Account. The contract checks the escro account to see if the amount of ADA has reached a pre-determined number. In this case, let’s set it at 100 ADA.

If that deposit pushes the escro account to or over 100 ADA, 50 ADA will be sent back to the user as winnings. 50 ADA will then also be sent to the profit account and the remainder (if any) will be left in the escro account for the next time a user sends ADA to it, starting the process over again.

This prevents those long, drawn out 50/50 raffle fundraisers that can last weeks or months and instead, can be something that stays active throughout - generating constant donations and payouts for the school.

It seems like a simple contract but when it comes to smart contracts, writing, making them live on the blockchain, etc - especially on the Cardano network, I feel like I should retire early and become a chicken farmer.

Any thoughts? Thank you.

2 Likes

There is a raffle example in the archives of example Marlowe contracts that have been run on the blockchain. The raffle that you describe is more complex and would likely need, in addition to the Marlowe contract itself, a small Plutus script (or a centralized supervisory service) to orchestrate the scenario that you describe.

1 Like

Ok, thanks - would that be due to the escrow account needed?

The additional complexity mostly results from the ongoing/revolving nature of the raffle that you described, which would involve more logic than just a “one shot” raffle that isn’t continuous or repeating.