1

From what I understand, each wallet would pay for a "ticket" and the raffle program would create a PDA for each wallet, tracking the wallet and number of raffle tickets.

However, I'm not sure where/how best to handle the actual raffle logic (selecting a random winner, timing...). Would this be implemented off-chain on a server, with some cronjob running an action when the raffle is over, which would then trigger another instruction within the raffle program to transfer the tokens?

Or could it also be done on the blockchain? I'd prefer to do it on-chain for transparency but I'm not sure about the potential limitations and how to go about structuring the accounts so that normal users can't call certain instructions and break/disrupt the raffle.

I'm looking for a simple implementation that could serve as a foundation, while still fitting as much as makes sense onto the blockchain.

2 Answers 2

2

Adding the dRaffle repo as reference here: https://github.com/draffle-io/draffle

Switchboard also has two demos for using Switchboard's verifiable randomness

Here is the vrf-demo-walkthrough: https://github.com/switchboard-xyz/vrf-demo-walkthrough

Here is the vrf-flip: https://github.com/switchboard-xyz/vrf-flip

0

ORAO has a very fast and cheap VRF available for Solana too. The SDK is on https://github.com/orao-network/solana-vrf

and there is a nice Solana Program integration example in the form of an on-chain Russian Roulette game here: https://github.com/orao-network/solana-vrf/tree/master/rust/examples/cpi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.