How can I create randomness with Solana?

Viewed 2552

I'm curious if there are currently any ways to create randomness in Solana programs?

I'm aware that Solana uses a proof of stake mechanism which implies to me that the blockhashes are not reliable since proof of stake mechanisms can easily create new blockhashes.

I'm also familiar with Chainlink's VRF on Ethereum, however it doesn't seem like this can be implemented on Solana, again due to proof of stake?

4 Answers

Shouldn't be a problem implementing something like chainlink's VRF oracle on Solana. It's based on pre-commitment and reveal.

Your question is a little vague, though.

Assume you you just want a random source, but you haven't elaborated on the type of randomness or the use-case.

While waiting for chainlink VRF you can also have a hasher and feed it with enough entropy to have a simulacre of random. But the repartition will be off for sure.

I do that with caller pubkey, current time from clock, and price of BTC at call time from chainlink oracle. But that's temporary, waiting on chainlink VRF.

Related